We are using this web socket implementation. On page load everything is correct and we start sending messages etc. When we loose connection and it gets back again the websocket sends ALL previous messages directly (the messageQueue is empty).
I've commented out this section and now it just creates a new connection without sending anything.
.retryWhen(errors => errors.switchMap(err => {
// update the connection state to let it know we're retrying
this.connectionState.next(ConnectionStates.RETRYING);
if(navigator.onLine) {
// if we have a network connection, try again in 3 seconds
return Observable.timer(3000);
} else {
// if we're offline, so wait for an online event.
return Observable.fromEvent(window, 'online').take(1);
}
}));
How can we make this not send old messages? We still want the retryWhen code since we need to do stuff when we gets back online.
Hi!
We are using this web socket implementation. On page load everything is correct and we start sending messages etc. When we loose connection and it gets back again the websocket sends ALL previous messages directly (the messageQueue is empty).
I've commented out this section and now it just creates a new connection without sending anything.
How can we make this not send old messages? We still want the retryWhen code since we need to do stuff when we gets back online.
Thanks