Skip to content

Commit

Permalink
wired up disconnect and websocket close handlers.
Browse files Browse the repository at this point in the history
  • Loading branch information
daveshanley committed Jan 5, 2025
1 parent de85e0d commit 9328f83
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/bus_engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ export class ranch implements Bus {
config.onConnect(frame);
}
}
this._stompClient.onDisconnect = (frame) => {
console.warn('Disconnected from the ranch')
if (config.onDisconnect) {
config.onDisconnect(frame);
}
}
this._stompClient.onWebSocketClose = ((frame: any) => {
console.warn('Socket connection to the ranch was closed, reconnecting...')
if (config.onDisconnect) {
config.onDisconnect(frame);
}
})
this._stompClient.activate()
}

private _mapDestination(destination: string, channel: string) {
Expand Down

0 comments on commit 9328f83

Please sign in to comment.