MCPcopy Index your code
hub / github.com/coder/websocket / SetReadLimit

Method SetReadLimit

read.go:97–105  ·  view source on GitHub ↗

SetReadLimit sets the max number of bytes to read for a single message. It applies to the Reader and Read methods. By default, the connection has a message read limit of 32768 bytes. When the limit is hit, reads return an error wrapping ErrMessageTooBig and the connection is closed with StatusMess

(n int64)

Source from the content-addressed store, hash-verified

95//
96// Set to -1 to disable.
97func (c *Conn) SetReadLimit(n int64) {
98 if n >= 0 {
99 // We read one more byte than the limit in case
100 // there is a fin frame that needs to be read.
101 n++
102 }
103
104 c.msgReader.limitReader.limit.Store(n)
105}
106
107const defaultReadLimit = 32768
108

Callers 5

TestConnFunction · 0.45
assertEchoFunction · 0.45
NetConnFunction · 0.45
TestWasmFunction · 0.45
EchoLoopFunction · 0.45

Calls

no outgoing calls

Tested by 3

TestConnFunction · 0.36
assertEchoFunction · 0.36
TestWasmFunction · 0.36