tmeasday/meteor-presence — pull request #18 by nathan-muir (2013-12-17 05:17:45+00:00)
Title: Overhauled presence to use the Meteor 0.6.7 connection API

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:

* No more client managed `sessionId` [and race conditions associated] , a custom `sessionKey` is generated for each connection.
* Configuration by `Meteor.Presence.configure()` instead of `Meteor.Presence.state = ` and `Meteor.settings`.
* Instant removal of presence on disconnect via `connection.onClose`
* Instant registration of `userId` with presence - via auto-subscribe
* Customisable client state function with options for value based isolation, and full reactive isolation
* Customisable client side "heartbeat"
* Server: Will clear all presences on startup - except if heartbeat is enabled on the server - allows for clusters of servers & removes presences created from servers that are no longer operating.

Incomplete/ Pending:
* Unit Tests. Although the structure changes might make that easier
* Server: Needs to restart presence for clients on the current server if the server manages to timeout (could be caused by database timeout)
* Would like to update `lastSeen` even when `state` & `heartbeat` aren't use client side. Could get accurate time from `_.debounce` to the `_.socket.on('data')`