Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Multiple subscribers to WebSocketSubject not getting data #1520

Open
arikimolloy opened this issue Oct 19, 2017 · 0 comments
Open

Multiple subscribers to WebSocketSubject not getting data #1520

arikimolloy opened this issue Oct 19, 2017 · 0 comments

Comments

@arikimolloy
Copy link

arikimolloy commented Oct 19, 2017

I'm using RxJS 4 (can't use 5 on this project). If I have multiple subscribers to the subject, only the first one subscribed seems to receive data. Does WebSocketSubject not work well with multiple subscribers?

simplified example:

webSocketSubject = Rx.DOM.fromWebSocket(
                this.url,
                null,
                openObserver,
                closingObserver
            );

webSocketSubject.subscribe(message => console.log('111'));
webSocketSubject.subscribe(message => console.log('222'));

Subscribe will kick off the socket, but only one of the subscribers (ends up being '222') gets data. If I throw a setTimeout around the second subscribe, then '111' will be the one who gets the data.

Thanks for the help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant