Skip to content

Controller types for WebSocket

Compare
Choose a tag to compare
@tajakobsen tajakobsen released this 08 Dec 14:58
· 215 commits to main since this release
a6a5e4a

Add types to controller.ts for handling websocket connections:

  • The WebSocketResponse interface can be used to initiate a connection
  • The WebSocketEvent type can be used by a webSocketEvent(event: WebSocketEvent) function in a controller to handle incoming messages and connections.
  • The Request.webSocket constant can be used to check if this is an attempt to open a web socket connection in a get(req: Request) function.