Skip to content

Instantly share code, notes, and snippets.

@sourishkrout
Created July 21, 2021 19:30
Show Gist options
  • Save sourishkrout/5637a08001a00b94d9f05cc740cfd4e2 to your computer and use it in GitHub Desktop.
Save sourishkrout/5637a08001a00b94d9f05cc740cfd4e2 to your computer and use it in GitHub Desktop.
Two lines 🤯
@@ -4,6 +4,7 @@ import { interval, merge, Observable, of, Subject, timer } from "rxjs";
import {
bufferTime,
catchError,
+ delayWhen,
filter,
map,
mergeAll,
@@ -346,6 +347,9 @@ export class EventManager {
this.stateMgr.getExtProps(),
this.authMgr.authToken()
);
+
+ const isConnected$ = wspub.getStatus().pipe(filter((connected) => connected));
+
this._publishers.set("ws", wspub);
merge(
windowEvent$,
@@ -358,6 +362,7 @@ export class EventManager {
session$
)
.pipe(
+ delayWhen((msg: any) => isConnected$),
catchError((e) => {
console.log(e);
this.channel.appendLine(e);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment