fix socket is null if PWA is offline
This commit is contained in:
parent
c0711879f7
commit
8488ce1402
1 changed files with 6 additions and 4 deletions
|
@ -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');
|
||||||
|
|
Loading…
Reference in a new issue