MCPcopy
hub / github.com/cloudflare/cloudflared / WriteEvent

Function WriteEvent

management/events.go:290–296  ·  view source on GitHub ↗

WriteEvent will write a Event type message to the websocket connection.

(c *websocket.Conn, ctx context.Context, event any)

Source from the content-addressed store, hash-verified

288
289// WriteEvent will write a Event type message to the websocket connection.
290func WriteEvent(c *websocket.Conn, ctx context.Context, event any) error {
291 payload, err := json.Marshal(event)
292 if err != nil {
293 return err
294 }
295 return c.Write(ctx, websocket.MessageText, payload)
296}
297
298// IsClosed returns true if the websocket error is a websocket.CloseError; returns false if not a
299// websocket.CloseError

Callers 7

RunFunction · 0.92
TestReadEventsLoopFunction · 0.85
streamLogsMethod · 0.85
TestReadServerEventFunction · 0.85
TestReadClientEventFunction · 0.85

Calls 2

WriteMethod · 0.65
MarshalMethod · 0.45

Tested by 5

TestReadEventsLoopFunction · 0.68
TestReadServerEventFunction · 0.68
TestReadClientEventFunction · 0.68