Skip to content

Commit

Permalink
roar
Browse files Browse the repository at this point in the history
  • Loading branch information
stopachka committed Sep 12, 2024
1 parent 390a162 commit 43136c9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion client/packages/core/src/Reactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,10 @@ export default class Reactor {
);
return;
}
if (this._isManualClose) {
log.info("[socket-close] manual close, will not reconnect");
return;
}

log.info("[socket-close] scheduling reconnect", this._reconnectTimeoutMs);
setTimeout(() => {
Expand All @@ -910,7 +914,15 @@ export default class Reactor {
}, this._reconnectTimeoutMs);
};

_ensurePreviousSocketClosed() {
if (this._ws && this._ws.readyState === WS_OPEN_STATUS) {
this._isManualClose = true;
this._ws.close();
}
}

_startSocket() {
this._ensurePreviousSocketClosed();
this._ws = new WebSocket(
`${this.config.websocketURI}?app_id=${this.config.appId}`,
);
Expand Down Expand Up @@ -1206,7 +1218,7 @@ export default class Reactor {
appId: this.config.appId,
refreshToken,
});
} catch (e) {}
} catch (e) { }
}

this.changeCurrentUser(null);
Expand Down

0 comments on commit 43136c9

Please sign in to comment.