The PubNub Publish/Subscribe JavaScript API Tutorial

0 MIN READ • Apr 3, 2015

pubnub javascript pub/sub api tutorialWe've built hundreds of tutorials using our PubNub JavaScript API, from simple chat applications, to data visualizations, to multiplayer games. The API at its core is a powerful way to stream data bidirectionally in real time between any number of connected devices.

Using the publish/subscribe design pattern, devices subscribe to a channel, and can receive data on that channel from a publisher. When it comes to a publish/subscribe JavaScript API, the use cases really are endless!

To get you started, we have a couple quick and dirty tutorials to get you sending and receiving messages via PubNub, but we wanted to do a more in-depth, comprehensive tutorial for those who wanted more. So we had two of our support gurus, Craig and Fred, host the first ever PubNub webinar.

Publish/Subscribe JavaScript Tutorial Overview

In the webinar tutorial, we go step-by-step through getting started with the PubNub JavaScript API, from signing up for a PubNub account all the way to building a simple real-time chat application. Our chat application will also implement the presence API for online user detection, and the history API to store and retrieve old chat messages.

Key topics covered will include:

  • Getting started with PubNub
  • Integrating the latest version of the SDK
  • Accessing the API
  • Initialization/subscribing to data channels
  • Publishing messages and log all sent messages over that channel
  • Presence/State detection (knowing when users enter/leave your app)
  • History (storing real-time data for future retrieval and playback)

Good news is, you didn't have to be there live, because we recorded the whole thing!

Additional JavaScript API Resources and Tutorials

May 12, 2015

Webinar: Building Real-time Apps with Android

We're hosting an Android webinar! Learn to build a real-time app for Android using the PubNub Java SDK, and other real-time features.
Michael Carroll
Michael Carroll
Dec 29, 2014

5 Step Tutorial for Real-time Device/User Detection

This walkthrough shows you how to build user detection and device detection using JavaScript and the Presence API.
Michael Carroll
Michael Carroll
Guides
Sep 7, 2023

Introduction to the PubNub Data Stream API | PubNub

This blog post is an introduction to the PubNub Data Stream API, enabling you to stream and send data in 1/10 second or less to any device.
Michael Carroll
Michael Carroll