Skip to content

OnOpen

OnOpen(): MethodDecorator

Defined in: src/decorators/websocket.ts:91

Decorator for WebSocket open handler. Return value is automatically set to ws.data and ctx.state.

MethodDecorator

@OnOpen()
handleOpen(ctx: ShokupanContext, ws: WebSocket) {
return { userId: getUserId(ctx) };
}