MakeSSEHandlerCh creates a new channel-based SSE handler
(w http.ResponseWriter, ctx context.Context)
| 81 | |
| 82 | // MakeSSEHandlerCh creates a new channel-based SSE handler |
| 83 | func MakeSSEHandlerCh(w http.ResponseWriter, ctx context.Context) *SSEHandlerCh { |
| 84 | return &SSEHandlerCh{ |
| 85 | w: w, |
| 86 | rc: http.NewResponseController(w), |
| 87 | ctx: ctx, |
| 88 | writeCh: make(chan SSEMessage, 10), // Buffered to prevent blocking |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | func (h *SSEHandlerCh) Context() context.Context { |
| 93 | return h.ctx |
no outgoing calls
no test coverage detected