MCPcopy
hub / github.com/nats-io/nats.go / writeCtrlFrames

Method writeCtrlFrames

ws.go:519–540  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

517}
518
519func (w *websocketWriter) writeCtrlFrames() (int, error) {
520 var (
521 n int
522 total int
523 i int
524 err error
525 )
526 for ; i < len(w.ctrlFrames); i++ {
527 buf := w.ctrlFrames[i]
528 n, err = w.w.Write(buf)
529 total += n
530 if err != nil {
531 break
532 }
533 }
534 if i != len(w.ctrlFrames) {
535 w.ctrlFrames = w.ctrlFrames[i+1:]
536 } else {
537 w.ctrlFrames = w.ctrlFrames[:0]
538 }
539 return total, err
540}
541
542func (w *websocketWriter) writeCloseMsg() (int, error) {
543 n, err := w.w.Write(w.cm)

Callers 1

WriteMethod · 0.95

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected