-
Notifications
You must be signed in to change notification settings - Fork 485
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
Suggestion for implementation of clients API #50
Conversation
I bumped socket.io and socket.io-client in the dev dependencies, obviously they will have to be bumped again if this goes in to reflect the other PRs I've made on this topic. |
socketio/socket.io-adapter#24 Just to link them together |
So, this is a great foundation for this patch. Thanks a lot for submitting this PR. I think it's going to require some minor refactoring to adapt to our goal of getting rid of pattern subscriptions. Otherwise, with minor potential API changes, this is the solution we'll deploy. The API changes I'm still debating in my mind are:
|
So far I think I'm No - Yes on those questions. |
If the answers were Yes - Yes, I think we should consider exposing two methods |
Oh, also I'm not sure about the local/remote clients thing. I'm leaning towards No - Yes myself, because I don't think the overhead will be too high, and once you get those IDs you could check them against the local state (though, peeking into internals, which isn't polite...) Honestly when I started this out I was envisioning being able to use a socket ID from a remote node to be able to emit a message from another node, but that seems like a convulted process as well. I almost wonder if this API should be introduced only if there is some kind of '(emit|broadcast)To' function that instead of operating on a socket, takes a socket ID. I have been struggling with the idea that perhaps the use case for clients as it stands isn't as useful as I thought. However, if enough people want it I don't mind anyway. |
@cha0s the API you mention already exists. Every socket joins a room identified by their session id. |
I totally forgot about that. Obviously that makes this a lot more useful than I thought when I wrote that post! |
adapted original cha0s's implementation to the latest pub-sub optimized version. socketio#50
Closed by #109 |
No description provided.