Skip to content

Instantly share code, notes, and snippets.

@AlexBHarley
Created September 4, 2016 11:24
Show Gist options
  • Save AlexBHarley/838a3991d0025b2ef12c669446134e27 to your computer and use it in GitHub Desktop.
Save AlexBHarley/838a3991d0025b2ef12c669446134e27 to your computer and use it in GitHub Desktop.
=== Current client API ===
client.onClientLogin( callback );
// subscribes the client to 'client logins' - PRESENCE_JOIN is the constant I'm using
client.onClientLogout( callback );
// subscribes 'client logouts' - PRESENCE_REMOVE
client.getConnectedClients( callback );
// sends a PN|Q+ - essentially just a query on C.TOPIC.PRESENCE
=== Current server implementation ===
- uses both a DistributedStateRegistry (DSR) and a SubscriptionRegistry (SR).
- DSR keeps track of connected clients, something that is not really easy to do with a SR.
- SR keeps track of subscriptions to the actions/events PRESENCE_REMOVE and PRESENCE_LOGIN
So when a clientA logs in, clients who are subscribed to PRESENCE_JOIN will be notified.
=== tests ===
Have set up some unit tests in both repos and some single node e2e ones in the client repo - seems to work quite well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment