Build a chat app with PubNub

This tutorial will guide you through creating a simple chat app using the flexible PubNub SDK: Sending and receiving chat messages, member presence and looking up past messages.

See a simple chat in action

Chat between browser tabs in the demo, or clone the tutorial app and build it step by step.

Demo

Chat in 10 Lines of Code

Send and receive chat messages between browser tabs with a few lines of plain JavaScript. A minimal PubNub starter built on publish and subscribe.

GitHub

PubNubDevelopers/Javascript-Chat-Tutorial-App

One folder per step of the tutorial, from the chat layout to message timestamps. It runs on the demo keys as is; for your own app, replace 'demo' in index.html with your keys and open it in two tabs.

git clone https://github.com/PubNubDevelopers/Javascript-Chat-Tutorial-App.git
View on Github

About this tutorial

In this getting started tutorial you will develop an in-app chat application using the PubNub SDK and backed by PubNub's reliable and scalable architecture:

  • Send and receive chat messages between instances of the app
  • Monitor the online / offline status of chat participants
  • Look up past messages
  • Set a friendly name for the app instance
  • Storage and retrieval of the friendly name using PubNub's serverless storage (App Context)