Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Forcefully disconnect from video rooms on tab close
Browse files Browse the repository at this point in the history
  • Loading branch information
robintown committed Apr 20, 2022
1 parent b57c64e commit a278799
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/stores/VideoChannelStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export default class VideoChannelStore extends AsyncStoreWithClient<null> {

this.connected = true;
messaging.once(`action:${ElementWidgetActions.HangupCall}`, this.onHangup);
window.addEventListener("beforeunload", this.setDisconnected);

this.emit(VideoChannelEvent.Connect, roomId);

Expand All @@ -193,6 +194,7 @@ export default class VideoChannelStore extends AsyncStoreWithClient<null> {
public setDisconnected = async () => {
this.activeChannel.off(`action:${ElementWidgetActions.HangupCall}`, this.onHangup);
this.activeChannel.off(`action:${ElementWidgetActions.CallParticipants}`, this.onParticipants);
window.removeEventListener("beforeunload", this.setDisconnected);

const roomId = this.roomId;
this.activeChannel = null;
Expand Down

0 comments on commit a278799

Please sign in to comment.