Skip to content

Commit

Permalink
unsubscribe CTRstream if socket reloads or fails (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
jggoebel authored Apr 26, 2024
1 parent edb8665 commit c24016c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/scenario/terminal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ export class TerminalComponent implements OnChanges, AfterViewInit, OnDestroy {
);
// we're going to try and rebuild things
// but only after waiting an appropriate mourning period...
this.subscription.unsubscribe();
this.subscription = new Subscription();
this.subscription.add(timer(5000).subscribe(() => this.buildSocket()));
}
};
Expand Down Expand Up @@ -172,6 +174,9 @@ export class TerminalComponent implements OnChanges, AfterViewInit, OnDestroy {

private closeSocket() {
if (!this.socket) return;
if (this.subscription) {
this.subscription.unsubscribe();
}
this.socket.close(WS_CODE_NORMAL_CLOSURE);
}

Expand Down

0 comments on commit c24016c

Please sign in to comment.