Last active
July 3, 2018 11:50
-
-
Save AlexDaSoul/581c2be8e5e2207aed1c5444bc2cfd3c to your computer and use it in GitHub Desktop.
ws-11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private connect(): void { | |
this.websocket$ = new WebSocketSubject(this.config); // создаем | |
// если есть сообщения, шлем их в дальше, | |
// если нет, ожидаем | |
// реконнектимся, если получили ошибку | |
this.websocket$.subscribe( | |
(message) => this.wsMessages$.next(message), | |
(error: Event) => { | |
if (!this.websocket$) { | |
// run reconnect if errors | |
this.reconnect(); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment