-
Notifications
You must be signed in to change notification settings - Fork 84
Closed
Description
I create a $websocket instance with the reconnect param: {"reconnectIfNotNormalClose": true} and the stream nicely reconnects on failures.
I have a problem with incoming messages:
ws.getDataStream().subscribe correctly fires on incoming messages until the websocket reconnects, after which it stops firing.
Am I missing a step so ws.getDataStream().subscribe continues firing after an automatic reconnection?
here is the code (comments welcome, I am new to js):
this.ws = new $WebSocket('wss://...', null, JSON.parse('{"reconnectIfNotNormalClose": true}'));
this.ws.getDataStream().subscribe(
(msg: MessageEvent) => console.log('message received: ', msg),
(err) => console.log('incoming websocket err', err),
() => console.log('incoming websocket complete')
);
I also tried moving the subscribe into the stream's onOpen, but it behaves the same as above (fires only for the initial connection):
this.ws = new $WebSocket('wss://...', null, JSON.parse('{"reconnectIfNotNormalClose": true}'));
this.stream.onOpen(
this.ws.getDataStream().subscribe(
(msg: MessageEvent) => console.log('message received: ', msg),
(err) => console.log('incoming websocket err', err),
() => console.log('incoming websocket complete')
)
);
Metadata
Metadata
Assignees
Labels
No labels