h.setupOnce.Do(h.setup)
ctx, cancel := context.WithCancel(ws.Request().Context())
+ defer cancel()
log := logger(ctx)
incoming := eventSource.NewSink()
return
}
+ // Receive websocket frames from the client and pass them to
+ // sess.Receive().
go func() {
buf := make([]byte, 2<<20)
for {
}
}()
+ // Take items from the outgoing queue, serialize them using
+ // sess.EventMessage() as needed, and send them to the client
+ // as websocket frames.
go func() {
for {
var ok bool