method WebSocketConnection.prototype.data
WebSocketConnection.prototype.data(): Map<string, unknown>

Per-connection application state, the socket-lifetime analogue of IRequestContext.state. Use it to attach an authenticated user id, a tenant, or any value later handlers and broadcasts need.

Return Type

Map<string, unknown>

Usage

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