method WebSocketConnection.prototype.close
WebSocketConnection.prototype.close(
code?: number,
reason?: string
): void

Closes the connection. Idempotent.

Parameters

optional
code: number

RFC 6455 close code (defaults to 1000)

optional
reason: string

Human-readable close reason

Return Type

void

Usage

import { WebSocketConnection } from "websocket-plugin/src/index.ts";