Skip to content

Instantly share code, notes, and snippets.

@AlexDaSoul
Last active July 3, 2018 11:50
Show Gist options
  • Save AlexDaSoul/581c2be8e5e2207aed1c5444bc2cfd3c to your computer and use it in GitHub Desktop.
Save AlexDaSoul/581c2be8e5e2207aed1c5444bc2cfd3c to your computer and use it in GitHub Desktop.
ws-11
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