SSEHandlerCh provides channel-based Server-Sent Events functionality
| 64 | |
| 65 | // SSEHandlerCh provides channel-based Server-Sent Events functionality |
| 66 | type SSEHandlerCh struct { |
| 67 | w http.ResponseWriter |
| 68 | rc *http.ResponseController |
| 69 | ctx context.Context // the r.Context() |
| 70 | writeCh chan SSEMessage |
| 71 | |
| 72 | lock sync.Mutex |
| 73 | closed bool |
| 74 | initialized bool |
| 75 | err error |
| 76 | |
| 77 | wg sync.WaitGroup |
| 78 | onCloseHandlers utilds.IdList[func()] |
| 79 | handlersRun bool |
| 80 | } |
| 81 | |
| 82 | // MakeSSEHandlerCh creates a new channel-based SSE handler |
| 83 | func MakeSSEHandlerCh(w http.ResponseWriter, ctx context.Context) *SSEHandlerCh { |
nothing calls this directly
no outgoing calls
no test coverage detected