-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Observable multiplexed from WebSocketSubject sends subMsg/unsubMsg to the server per every subscription #2445
Comments
any answer? |
@benlesh please help us :) |
I completely agree with @mpodlasin . I expected the same behavior. I would say it's more like a feature than a bug ;) |
+1 Is there a workaround for this issue that doesn't involve having the server keep track of subscribers? The documentation mentions using publish(), but I've tried variations of both publish and share, and find that the unsubscribe message either
|
For everyone landing here find a solution to user multiple subscriptions to multiplexed channel: use |
Hi.
Assume I get an Observable from multiplexing a WebSocketSubject:
I would assume that "sub" message would be sent to the server only on the first subscribtion. On second subscription server already pumps values to the client, so there is no need to send "sub" second time.
Conversely "unsub" should be sent when last consumer unsubscribes, but not when there is still someone subscribing.
And yet currently "unsub" will be sent whenever any consumer unsubscribes from an Observable. That means server needs to have its own counting logic (how many subscriptions it has on the client), otherwise whenever any consmer unsubscribes, all other consumers will stop getting messages, since server will stop pumping them (it got "unsub", so it assumes no one wants to listen).
So there is potential bug with sending "unsub" as well as unneccessary sending of "sub" (which may actually confuse server as well).
A bug?
A feature? If so, why?
The text was updated successfully, but these errors were encountered: