Remove usage of userInfo in app.js; make storage aware of connection status to avoid connecting to the server in offline mode; fix updateChaInList querying for non-existent elements and using them blindly; make websocket also check connection status on reload.
This commit is contained in:
parent
3a1ed0903c
commit
a021ca821f
4 changed files with 66 additions and 39 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { config } from "./config.js";
|
||||
import { isOnline, updateOnlineStatus } from "./storage.js";
|
||||
|
||||
let socket = null;
|
||||
let reconnectTimer = null;
|
||||
|
|
@ -6,6 +7,7 @@ let currentOnMessageCallback = null;
|
|||
|
||||
export const websocket = {
|
||||
connect(onMessageCallback) {
|
||||
if (!isOnline) return;
|
||||
currentOnMessageCallback = onMessageCallback;
|
||||
|
||||
this.disconnect(false);
|
||||
|
|
@ -64,6 +66,7 @@ export const websocket = {
|
|||
socket = null;
|
||||
|
||||
reconnectTimer = setTimeout(() => {
|
||||
updateOnlineStatus();
|
||||
this.connect(currentOnMessageCallback);
|
||||
}, 5000);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue