* Handle a websocket at this route. Note that websockets are immediately * paused when they come in. * * If the origin header exists it must match the host or the connection will * be prevented.
(route: expressCore.PathParams, ...handlers: WebSocketHandler[])
| 48 | * be prevented. |
| 49 | */ |
| 50 | public ws(route: expressCore.PathParams, ...handlers: WebSocketHandler[]): void { |
| 51 | this.router.get( |
| 52 | route, |
| 53 | ...handlers.map((handler) => { |
| 54 | const wrapped: express.Handler = (req, res, next) => { |
| 55 | ;(req as InternalWebsocketRequest)._ws_handled = true |
| 56 | return handler(req as WebsocketRequest, res, next) |
| 57 | } |
| 58 | return wrapped |
| 59 | }), |
| 60 | ) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | export function Router(): WebsocketRouter { |
no outgoing calls
no test coverage detected