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

Method WriteString

conn.go:684–700  ·  view source on GitHub ↗
(p string)

Source from the content-addressed store, hash-verified

682}
683
684func (w *messageWriter) WriteString(p string) (int, error) {
685 if w.err != nil {
686 return 0, w.err
687 }
688
689 nn := len(p)
690 for len(p) > 0 {
691 n, err := w.ncopy(len(p))
692 if err != nil {
693 return 0, err
694 }
695 copy(w.c.writeBuf[w.pos:], p[:n])
696 w.pos += n
697 p = p[n:]
698 }
699 return nn, nil
700}
701
702func (w *messageWriter) ReadFrom(r io.Reader) (nn int64, err error) {
703 if w.err != nil {

Callers 6

TestFramingFunction · 0.80
TestWriteBufferPoolFunction · 0.80
TestWriteBufferPoolErrorFunction · 0.80
TestRespOnBadHandshakeFunction · 0.80
serveHomeFunction · 0.80

Calls 1

ncopyMethod · 0.95

Tested by 5

TestFramingFunction · 0.64
TestWriteBufferPoolFunction · 0.64
TestWriteBufferPoolErrorFunction · 0.64
TestRespOnBadHandshakeFunction · 0.64