Skip to content

Function: OnClose()

ts
function OnClose(): MethodDecorator;

Defined in: packages/core/src/websocket/ws-handlers.decorator.ts:58

Marks a gateway method as the WebSocket close handler. Called when a client disconnects.

Returns

MethodDecorator

Example

typescript
@OnClose()
handleClose(ws: ElysiaWsContext) {}

Released under the MIT License.