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

Method Writer

ws_js.go:348–355  ·  view source on GitHub ↗

Writer returns a writer to write a WebSocket data message to the connection. It buffers the entire message in memory and then sends it when the writer is closed.

(ctx context.Context, typ MessageType)

Source from the content-addressed store, hash-verified

346// It buffers the entire message in memory and then sends it when the writer
347// is closed.
348func (c *Conn) Writer(ctx context.Context, typ MessageType) (io.WriteCloser, error) {
349 return &writer{
350 c: c,
351 ctx: ctx,
352 typ: typ,
353 b: bpool.Get(),
354 }, nil
355}
356
357type writer struct {
358 closed bool

Callers 4

TestConnFunction · 0.45
EchoLoopFunction · 0.45
echoFunction · 0.45

Calls 1

GetFunction · 0.92

Tested by 2

TestConnFunction · 0.36