-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
how to broadcast to all connected clients? #23
Comments
Similar to this socket featureset, I guess? |
I'm also happy to work on this one, depending on how you feel on this extended channel or topic functionality. |
I'd be interested in this functionality too. |
Oh, just posted to the Google group. Will copy, let's keep the discussion going here instead: I'll be honest I'm a little hesitant to add any kind of room/subscription facilities to Sente itself... My thinking currently goes:
Instead, I'd propose to just expose a set of currently-connected uids. You can then intersect that set against any subscription/channel logic you may have. Having said all that, I'm not sure what Socket.IO's rationale was when they chose to bundle subscription semantics into the core API so I might well be missing something... Does that make sense? What do you think? Is your concern more that maintaining your own subscription data will be a nuisance, or that it's difficult to do? Am definitely open to ideas I may not have thought of. @seancorfield Would be happy to get your thoughts too Sean! |
Have added a quick commit to the dev branch that returns a There's a couple ways it could be implemented - need to do some benching. Won't take long, just swamped atm - will try find time in the next day or two. |
Okay, just pushed Also updated the example broadcaster to show how to use it, but it's pretty straight-forward. Closing this issue for now, but feel free to reopen if either of you have any additional thoughts. Cheers! :-) |
Totally agree that this should be built outside of the core library. I think that that atom is enough to build out the rest. For broadcasting to multiple folks, do you recommend just doseqing through calls to ch-send!, or is there some bulk send operation I could add that would make this more efficient? On Wed, Apr 16, 2014 at 3:20 AM, Peter Taoussanis
|
I think a doseq should be fine - the send call is async. For large broadcasts, I'll sometimes actually induce a pause between sends. I'll define a window - say 100ms - and distribute sends evenly over that window to keep the server load smooth rather than spikey. Does that make sense? |
Oh, I should add - if you try send to a disconnected client, it's just a noop. So no need to worry about a |
Hey Peter, Sorry for my silence, I've been on the road traveling back out to Cali. Thanks for all your advice. I'll ping back if I run into any trouble. Sente's the solid foundation I needed to get working on this stuff. |
Hey Sam, no problem - just shout if there's something I can assist with. Cheers! :-) |
Socket.io allows broadcast to every client, or to every client except the sender. I'm using Sente to broadcast race results in realtime to every connected browser - this feels difficult in the current API.
I think what I want is socket.io style channels in addition to the per user channels. I can fake this by using the "uid" as a channel ID for now. Just wanted to gather thoughts.
The text was updated successfully, but these errors were encountered: