fix socket is null if PWA is offline

This commit is contained in:
schlagmichdoch 2023-02-04 16:22:57 +01:00
parent c0711879f7
commit 8488ce1402

View file

@ -139,11 +139,13 @@ class ServerConnection {
_disconnect() { _disconnect() {
this.send({ type: 'disconnect' }); this.send({ type: 'disconnect' });
if (this._socket) {
this._socket.onclose = null; this._socket.onclose = null;
this._socket.close(); this._socket.close();
this._socket = null; this._socket = null;
Events.fire('ws-disconnected'); Events.fire('ws-disconnected');
} }
}
_onDisconnect() { _onDisconnect() {
console.log('WS: server disconnected'); console.log('WS: server disconnected');