Properly close ui websocket connections on browser close
This commit is contained in:
parent
670594c0cb
commit
c9c6246c4c
|
|
@ -75,6 +75,10 @@ const initStores = (): StoreMapping => {
|
|||
|
||||
stores.currentUser.tryAuthenticate().catch(() => {});
|
||||
|
||||
window.onbeforeunload = () => {
|
||||
stores.wsStore.close();
|
||||
};
|
||||
|
||||
ReactDOM.render(
|
||||
<InjectProvider stores={stores}>
|
||||
<Layout />
|
||||
|
|
|
|||
|
|
@ -50,5 +50,5 @@ export class WebSocketStore {
|
|||
this.ws = ws;
|
||||
};
|
||||
|
||||
public close = () => this.ws && this.ws.close();
|
||||
public close = () => this.ws && this.ws.close(1000, 'WebSocketStore#close');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue