8460: Support created_at filters.
[arvados.git] / services / ws / session.go
1 package main
2
3 type session interface {
4         // Receive processes a message received from the client. If
5         // the returned response is non-nil, it will be queued and
6         // sent the client.
7         Receive(map[string]interface{}, []byte) []byte
8
9         // Filter returns true if the event should be queued for
10         // sending to the client. It should return as fast as
11         // possible, and must not block.
12         Filter(*event) bool
13
14         // EventMessage encodes the given event (from the front of the
15         // queue) into a form suitable to send to the client. If a
16         // non-nil error is returned, the connection is terminated. If
17         // the returned buffer is empty, nothing is sent to the client
18         // and the event is not counted in statistics.
19         //
20         // Unlike Filter, EventMessage can block without affecting
21         // other connections. If EventMessage is slow, additional
22         // incoming events will be queued. If the event queue fills
23         // up, the connection will be dropped.
24         EventMessage(*event) ([]byte, error)
25
26         debugLogf(string, ...interface{})
27 }