MCPcopy
hub / github.com/gorilla/websocket / NextWriter

Method NextWriter

conn.go:518–530  ·  conn.go::Conn.NextWriter

NextWriter returns a writer for the next message to send. The writer's Close method flushes the complete message to the network. There can be at most one open writer on a connection. NextWriter closes the previous writer if the application has not already done so. All message types (TextMessage, B

(messageType int)

Source from the content-addressed store, hash-verified

516// All message types (TextMessage, BinaryMessage, CloseMessage, PingMessage and
517// PongMessage) are supported.
518func (c *Conn) NextWriter(messageType int) (io.WriteCloser, error) {
519 var mw messageWriter
520 if err := c.beginMessage(&mw, messageType); err != nil {
521 return nil, err
522 }
523 c.writer = &mw
524 if c.newCompressionWriter != nil && c.enableWriteCompression && isData(messageType) {
525 w := c.newCompressionWriter(c.writer, c.compressionLevel)
526 mw.compress = true
527 c.writer = w
528 }
529 return c.writer, nil
530}
531
532type messageWriter struct {
533 c *Conn

Callers 15

WriteMessageMethod · 0.95
WriteJSONMethod · 0.95
TestFramingFunction · 0.80
TestControlFunction · 0.80
TestWriteBufferPoolFunction · 0.80
TestWriteBufferPoolErrorFunction · 0.80
TestEOFWithinFrameFunction · 0.80
TestEOFBeforeFinalFrameFunction · 0.80
TestReadLimitFunction · 0.80
TestBufioReadBytesFunction · 0.80

Calls 2

beginMessageMethod · 0.95
isDataFunction · 0.85

Tested by 11

TestFramingFunction · 0.64
TestControlFunction · 0.64
TestWriteBufferPoolFunction · 0.64
TestWriteBufferPoolErrorFunction · 0.64
TestEOFWithinFrameFunction · 0.64
TestEOFBeforeFinalFrameFunction · 0.64
TestReadLimitFunction · 0.64
TestBufioReadBytesFunction · 0.64
ServeHTTPMethod · 0.64