MCPcopy
hub / github.com/coder/websocket / writeControl

Method writeControl

write.go:276–285  ·  view source on GitHub ↗
(ctx context.Context, opcode opcode, p []byte)

Source from the content-addressed store, hash-verified

274}
275
276func (c *Conn) writeControl(ctx context.Context, opcode opcode, p []byte) error {
277 ctx, cancel := context.WithTimeout(ctx, time.Second*5)
278 defer cancel()
279
280 _, err := c.writeFrame(ctx, true, false, opcode, p)
281 if err != nil {
282 return fmt.Errorf("failed to write control frame %v: %w", opcode, err)
283 }
284 return nil
285}
286
287// writeFrame handles all writes to the connection.
288func (c *Conn) writeFrame(ctx context.Context, fin bool, flate bool, opcode opcode, p []byte) (_ int, err error) {

Callers 3

writeCloseMethod · 0.95
pingMethod · 0.95
handleControlMethod · 0.95

Calls 1

writeFrameMethod · 0.95

Tested by

no test coverage detected