1
0
mirror of https://github.com/spacebarchat/client.git synced 2025-01-31 19:41:37 +01:00

disable gateway reconnect

This commit is contained in:
Puyodead1 2025-01-14 18:08:18 -05:00
parent 07c63dee16
commit 1f8a887e01
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC

View File

@ -113,12 +113,12 @@ export default class GatewayConnectionStore {
this.logger.debug(`[Disconnect] ${this.url}`);
this.socket?.close(code, reason);
}
reconnecting=false;
reconnecting = false;
startReconnect() {
if(this.reconnecting)return;
this.reconnecting=true;
if (this.reconnecting) return;
this.reconnecting = true;
setTimeout(() => {
this.reconnecting=false;
this.reconnecting = false;
this.logger.debug("Starting reconnect...");
this.connect(this.url!);
}, this.reconnectTimeout);
@ -339,16 +339,18 @@ export default class GatewayConnectionStore {
// dont reconnect on "going away"
if (code === 1001) return;
if (this.reconnectTimeout === 0) this.reconnectTimeout = RECONNECT_TIMEOUT;
else this.reconnectTimeout += RECONNECT_TIMEOUT;
// if (this.reconnectTimeout === 0) this.reconnectTimeout = RECONNECT_TIMEOUT;
// else this.reconnectTimeout += RECONNECT_TIMEOUT;
this.logger.debug(
`Websocket closed with code ${code}; Will reconnect in ${(this.reconnectTimeout / 1000).toFixed(
2,
)} seconds.`,
);
// this.logger.debug(
// `Websocket closed with code ${code}; Will reconnect in ${(this.reconnectTimeout / 1000).toFixed(
// 2,
// )} seconds.`,
// );
this.startReconnect();
alert(`Gateway connection closed with code ${code}, please refresh the page`);
// this.startReconnect();
};
/**