Use pattern matching at the namespace level#217
Merged
darrachequesne merged 4 commits intosocketio:masterfrom May 10, 2017
Merged
Use pattern matching at the namespace level#217darrachequesne merged 4 commits intosocketio:masterfrom
darrachequesne merged 4 commits intosocketio:masterfrom
Conversation
This follows socketio#46. Each node will now listen to only three channels: - `socket.io#<namespace>#*`: used when broadcasting - `socket.io-request#<namespace>#`: used for requesting information (ex: get every room in the cluster) - `socket.io-response#<namespace>#`: used for responding to requests We keep the benefits of socketio#46 since: - messages from other namespaces are ignored - when emitting to a single room, the message is sent to `socket.io#<namespace>#<my-room>`, so listeners can check whether they have the room before unpacking the message (which is CPU consuming). But there is no need to subscribe / unsubscribe every time a socket joins or leaves a room (which is also CPU consuming when there are thousands of subscriptions).
|
So, as a consequence of this change (not subscribing to specific rooms, but instead to generic namespaces). The result will be that EVERY client will get EVERY message correct? While, I see that you're checking before you unpack the message, there is no way to horizontally scale this at some point. The overhead of receiving/checking every message from every client on the entire system seems to be a big problem for apps with high workloads. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This follows #46. Each node will now listen to only three channels:
socket.io#<namespace>#*: used when broadcastingsocket.io-request#<namespace>#: used for requesting information (ex: get every room in the cluster)socket.io-response#<namespace>#: used for responding to requestsWe keep the benefits of #46 since:
socket.io#<namespace>#<my-room>, so listeners can check whether theyhave the room before unpacking the message (which is CPU consuming).
But there is no need to subscribe / unsubscribe every time a socket
joins or leaves a room (which is also CPU consuming when there are
thousands of subscriptions).