MCPcopy
hub / github.com/coder/websocket / Close

Method Close

ws_js.go:231–237  ·  view source on GitHub ↗

Close closes the WebSocket with the given code and reason. It will wait until the peer responds with a close frame or the connection is closed. It thus performs the full WebSocket close handshake.

(code StatusCode, reason string)

Source from the content-addressed store, hash-verified

229// or the connection is closed.
230// It thus performs the full WebSocket close handshake.
231func (c *Conn) Close(code StatusCode, reason string) error {
232 err := c.exportedClose(code, reason)
233 if err != nil {
234 return fmt.Errorf("failed to close WebSocket: %w", err)
235 }
236 return nil
237}
238
239// CloseNow closes the WebSocket connection without attempting a close handshake.
240// Use when you do not want the overhead of the close handshake.

Callers 7

closeWithInternalMethod · 0.95
ReadMethod · 0.95
readMethod · 0.95
CloseNowMethod · 0.95
dialFunction · 0.95
CloseReadMethod · 0.95
exportedCloseMethod · 0.45

Calls 1

exportedCloseMethod · 0.95

Tested by

no test coverage detected