MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / SendSSEvent

Method SendSSEvent

tsunami/engine/clientimpl.go:282–302  ·  view source on GitHub ↗
(event ssEvent)

Source from the content-addressed store, hash-verified

280}
281
282func (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
304func (c *ClientImpl) SendAsyncInitiation() error {
305 return c.SendSSEvent(ssEvent{Event: "asyncinitiation", Data: nil})

Callers 3

SendAsyncInitiationMethod · 0.95
SendTermWriteMethod · 0.95
ShowModalMethod · 0.95

Calls 1

GetIsDoneMethod · 0.95

Tested by

no test coverage detected