Properly unwrap StateEvent state before calling handler

This commit is contained in:
2022-08-09 22:27:19 -05:00
parent b8cf8499d2
commit 8a153e3807
2 changed files with 4 additions and 2 deletions

View File

@@ -93,7 +93,9 @@ export class SocketRouteBuilder {
*/
async build(request: Request, ws: WebSocketBus): Promise<void> {
await this.handlers.promiseMap(handler => {
ws.subscribe(handler.eventClass, handler.handler.apply(request))
ws.subscribe(handler.eventClass, (event: StateEvent<JSONState>) => {
return handler.handler.apply(request)(event.getState())
})
})
if ( this.connectionCallback ) {