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

Method Read

read.go:41–49  ·  view source on GitHub ↗

Read is a convenience method around Reader to read a single message from the connection.

(ctx context.Context)

Source from the content-addressed store, hash-verified

39// Read is a convenience method around Reader to read a single message
40// from the connection.
41func (c *Conn) Read(ctx context.Context) (MessageType, []byte, error) {
42 typ, r, err := c.Reader(ctx)
43 if err != nil {
44 return 0, nil, err
45 }
46
47 b, err := io.ReadAll(r)
48 return typ, b, err
49}
50
51// CloseRead starts a goroutine to read from the connection until it is closed
52// or a data message is received.

Callers 10

TestConnFunction · 0.45
goDiscardLoopMethod · 0.45
BenchmarkConnFunction · 0.45
TestConnClosePropagationFunction · 0.45
testMaskFunction · 0.45
RecordBytesReadMethod · 0.45
ReadMethod · 0.45
readMethod · 0.45
ReadMethod · 0.45

Calls 1

ReaderMethod · 0.95

Tested by 7

TestConnFunction · 0.36
goDiscardLoopMethod · 0.36
BenchmarkConnFunction · 0.36
TestConnClosePropagationFunction · 0.36
testMaskFunction · 0.36
RecordBytesReadMethod · 0.36