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

Method Write

write.go:43–49  ·  view source on GitHub ↗

Write writes a message to the connection. See the Writer method if you want to stream a message. If compression is disabled or the compression threshold is not met, then it will write the message in a single frame.

(ctx context.Context, typ MessageType, p []byte)

Source from the content-addressed store, hash-verified

41// If compression is disabled or the compression threshold is not met, then it
42// will write the message in a single frame.
43func (c *Conn) Write(ctx context.Context, typ MessageType, p []byte) error {
44 _, err := c.write(ctx, typ, p)
45 if err != nil {
46 return fmt.Errorf("failed to write msg: %w", err)
47 }
48 return nil
49}
50
51type msgWriter struct {
52 c *Conn

Callers 3

writeCompressedFrameMethod · 0.45
WriteMethod · 0.45
writeFramePayloadMethod · 0.45

Calls 1

writeMethod · 0.95

Tested by

no test coverage detected