disconnect on navigator.connection.change

This commit is contained in:
schlagmichdoch 2023-01-10 14:52:39 +01:00
parent 516e1ddf59
commit 7deeba161b

View file

@ -8,6 +8,9 @@ class ServerConnection {
Events.on('beforeunload', _ => this._disconnect()); Events.on('beforeunload', _ => this._disconnect());
Events.on('pagehide', _ => this._disconnect()); Events.on('pagehide', _ => this._disconnect());
document.addEventListener('visibilitychange', _ => this._onVisibilityChange()); document.addEventListener('visibilitychange', _ => this._onVisibilityChange());
if (navigator.connection) {
navigator.connection.addEventListener('change', _ => this._disconnect());
}
Events.on('reconnect', _ => this._reconnect()); Events.on('reconnect', _ => this._reconnect());
Events.on('room-secrets', e => this._sendRoomSecrets(e.detail)); Events.on('room-secrets', e => this._sendRoomSecrets(e.detail));
Events.on('room-secret-deleted', e => this.send({ type: 'room-secret-deleted', roomSecret: e.detail})); Events.on('room-secret-deleted', e => this.send({ type: 'room-secret-deleted', roomSecret: e.detail}));