-
Notifications
You must be signed in to change notification settings - Fork 4
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
Overhauled presence to use the Meteor 0.6.7 connection API #18
Conversation
… users as they connect / disconnect.
Hey Nathan, thanks for the PR. Myself and Tom have been in the process ourselves of doing a re-write, taking advantage of the new connection api as well. You can see the work (in progress) over here: https://github.com/dburles/meteor-presence As you can see the code has been greatly simplified. I've got a question in relation to your usage of a heartbeat, this was a consideration of mine as a way to deal with the lengthy duration that long polling clients remain connected. Obviously this is not ideal when we're wanting to display active users! |
I'm also quite interested in how you're handling multiple servers as this is something that i've not yet looked into |
Haha, our results look very similar - You're checking for Otherwise, my branch has a few additions:
|
@dburles Missed the question there about client heartbeat. This is just an optional setting - eg, if someone needs the edit: off-topic |
Interesting stuff. Though my thoughts on things like the lastSeen timer for example, raises the question of calling Meteor.disconnect() on idle which has an effect greater than what the core purpose of this package should really provide. My idea on the ideal direction to take the package should be so that it provides a very solid battle-tested core that at least for now, feature-wise, does nothing more than provide the presence collection and allow clients to make use of the state function. Then from that point on extra features can be added if it makes sense to. There are still some issues I've been seeing with my re-write surrounding dealing with clients connected through long-polling (they long time to drop off), as well as multiple-servers (untested), and possibly other edge cases. So these parts are the low end stuff I've been trying to iron-out. Any ideas you have on that side would be great. |
Also on the question of publicising the internal connection/session id, I'm not sure at this point whether or not that is a bad idea |
I seem to be great at misreading today - specifically talking about long polling eg. websocket fallback - the heartbeat implementation I'm using has no effect - all it does is call What issues have you had with long-polling? I've just done some cursory testing meteor using |
Oh right, rethinking it, the delay I experienced was most likely then from earlier when I was using the publish hack |
So, I was about to do a PR for https://github.com/nathan-muir/meteor-presence/tree/tail-call-timeout - but noticed -that Meteor 0.6.7 officially establishes the "connection" API - and decided to go a little crazy and rewrite presence to take advantage of it.
Features:
sessionId
[and race conditions associated] , a customsessionKey
is generated for each connection.Meteor.Presence.configure()
instead ofMeteor.Presence.state =
andMeteor.settings
.connection.onClose
userId
with presence - via auto-subscribeIncomplete/ Pending:
lastSeen
even whenstate
&heartbeat
aren't use client side. Could get accurate time from_.debounce
to the_.socket.on('data')