On v1 we have a reconnect method that is triggered when we lose connection or when we change the websocket URL. We should implement a similar thing in v2.
For reference:
reconnectToWebSocket() {
if (this.active_connection && this.active_connection.connected) {
this.active_connection.close();
}
if (this.connectionTimeout) {
clearTimeout(this.connectionTimeout);
}
console.log(`Reconnecting in ${this.connectionCooldown} seconds.`);
this.connectionTimeout = setTimeout(this.connectToWebsocket, this.connectionCooldown * 1000);
this.backoffCooldown();
}
On v1 we have a reconnect method that is triggered when we lose connection or when we change the websocket URL. We should implement a similar thing in v2.
For reference: