Build

5 Step Tutorial for Real-time Device and User Detection

1 min readJoe Hanson on Dec 29, 2014
Try PubNub Today

Free up to 1MM monthly messages. No credit card required.

Subscribe to our newsletter

By submitting this form, you are agreeing to our Terms and Conditions and Privacy Policy.

This walkthrough shows you how to build user detection and device detection using JavaScript and the PubNub Presence API.

Real-time Device and User DetectionTracking the online/offline status of users and devices is called ‘presence.’ It’s a powerful tool for building chat rooms, multiplayer gaming, machine-to-machine communication, and sensor networks to name a few.

In this tutorial, we’ll show you how to implement presence user detection functionality into your application in 6 easy steps.

  1. Install PubNub API
  2. Input publish/subscribe keys
  3. Subscribe with presence events
  4. Unsubscribe
  5. Detect users in the channel

And huzzah! You’re off and running with a simple presence application!

In the video below, Stephen and Tomomi walks you through the process step-by-step. If you want to follow along, check out our Presence Quick Start Tutorial for the code from the video, and use your favorite text editor and the JavaScript console.

Building Real-time Device and User Detection with Presence from PubNub on Vimeo.

We have a number of other quick start tutorials around our core features including:

  • Pub/Sub Messaging: Basic publish-subscribe messaging for web, mobile, and IoT apps
  • Storage & Playback: Store real-time message streams for future retrieval and playback
  • Access Manager: Control access permissions to streams of data by person, device, or channel

Additional Presence User/Device Detection Resources

More from PubNub

Can Empathy Exist in the Metaverse
News May 16, 20221 min read

Can Empathy Exist in the Metaverse

A roundtable discussion led by PubNub’s COO, Casey Clegg, exploring the topics of what it means to be human in a virtual world.

PubNub Staff

PubNub Staff

How to Advance Telehealth and Virtual Care Technologies
News May 2, 20221 min read

How to Advance Telehealth and Virtual Care Technologies

Dr. Joe Kvedar, Chair of the Board for the American Telemedicine Association, joins our COO, Casey Clegg, to discuss why...

PubNub Staff

PubNub Staff

Another Step Towards Data Security: ISO-27001 Implementation
BuildMay 2, 20221 min read

Another Step Towards Data Security: ISO-27001 Implementation

Today, we are glad to announce that we are currently in the process of implementing ISO-27001 security standards.

PubNub Staff

PubNub Staff