Skip to main content
WebSocket.close - WebSockets - Web documentation
method WebSocket.close
WebSocket.close(
code?: number,
reason?: string,
): void

Closes the WebSocket connection, optionally using code as the WebSocket connection close code and reason as the WebSocket connection close reason.

Parameters

optional
code: number
optional
reason: string

Return Type

void