Presence

Detect when users enter/leave your app and whether machines are online

What it Does

  • Show who is online and when they leave
  • Trigger events based on audience size
  • Detect machine connections
  • Critical for chat rooms, game lobbies and machine-to-machine

Features

  • Occupancy to monitor user and machine presence in real-time
  • Join/Leave Notification for immediate updates of all client connections
  • Global Scale with synchronized servers across the PubNub Real-Time Network
  • Alexa Robertson
    Offline Online
  • Michael Jonathan
    Offline Online
  • Machine 1
    Offline Online
  • Machine 2
    Offline Online

Resources

Get the Code
    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
  1. // Get List of Occupants and Occupancy Count.
  2.  
  3. pubnub.here_now({
  4. channel : 'my_channel',
  5. callback : function(m){console.log(m)}
  6. });
    1. 1
    2. 2
    3. 3
    4. 4
  1. // Get List of Occupants and Occupancy Count.
  2.  
  3. pubnub.HereNow<string>(channel="mychannel",
  4. DisplayReturnMessage, DisplayErrorMessage);
    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    10. 10
    11. 11
    12. 12
    13. 13
  1. // Get List of Occupants and Occupancy Count.
  2.  
  3. pubnub.hereNow(channel, new Callback() {
  4. public void successCallback(String channel,
  5. Object message) {
  6. notifyUser(message.toString());
  7. }
  8. public void errorCallback(String channel,
  9. Object message) {
  10. notifyUser(channel + " : " +
  11. message.toString());
  12. }
  13. });
Watch the Video