MCPcopy
hub / github.com/olahol/melody / CloseWithMsg

Method CloseWithMsg

session.go:194–202  ·  view source on GitHub ↗

CloseWithMsg closes the session with the provided payload. Use the FormatCloseMessage function to format a proper close message payload.

(msg []byte)

Source from the content-addressed store, hash-verified

192// CloseWithMsg closes the session with the provided payload.
193// Use the FormatCloseMessage function to format a proper close message payload.
194func (s *Session) CloseWithMsg(msg []byte) error {
195 if s.closed() {
196 return ErrSessionClosed
197 }
198
199 s.writeMessage(envelope{t: websocket.CloseMessage, msg: msg})
200
201 return nil
202}
203
204// Set is used to store a new key/value pair exclusively for this session.
205// It also lazy initializes s.Keys if it was not used previously.

Callers

nothing calls this directly

Calls 2

closedMethod · 0.95
writeMessageMethod · 0.95

Tested by

no test coverage detected