RegisterOnClose registers a handler function to be called when the connection closes Returns an ID that can be used to unregister the handler
(fn func())
| 318 | // RegisterOnClose registers a handler function to be called when the connection closes |
| 319 | // Returns an ID that can be used to unregister the handler |
| 320 | func (h *SSEHandlerCh) RegisterOnClose(fn func()) string { |
| 321 | h.lock.Lock() |
| 322 | defer h.lock.Unlock() |
| 323 | return h.onCloseHandlers.Register(fn) |
| 324 | } |
| 325 | |
| 326 | // UnregisterOnClose removes a previously registered onClose handler by ID |
| 327 | func (h *SSEHandlerCh) UnregisterOnClose(id string) { |
no test coverage detected