(event ssEvent)
| 280 | } |
| 281 | |
| 282 | func (c *ClientImpl) SendSSEvent(event ssEvent) error { |
| 283 | if c.GetIsDone() { |
| 284 | return fmt.Errorf("client is done") |
| 285 | } |
| 286 | |
| 287 | c.SSEChannelsLock.Lock() |
| 288 | defer c.SSEChannelsLock.Unlock() |
| 289 | |
| 290 | // Send to all registered SSE channels |
| 291 | for _, ch := range c.SSEChannels { |
| 292 | select { |
| 293 | case ch <- event: |
| 294 | // Successfully sent |
| 295 | default: |
| 296 | // silently drop (below is just for debugging). this wont happen in general |
| 297 | // log.Printf("SSEvent channel is full for connection %s, skipping event", connectionId) |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | return nil |
| 302 | } |
| 303 | |
| 304 | func (c *ClientImpl) SendAsyncInitiation() error { |
| 305 | return c.SendSSEvent(ssEvent{Event: "asyncinitiation", Data: nil}) |
no test coverage detected