/JavaScript-Simple-Chat

Example of a simple live chat app in JavaScript using PubNub in only 10 lines of code.

Primary LanguageHTMLThe UnlicenseUnlicense

JavaScript Simple Chat Demo in fewer than 10 lines of code

How easy is it to create a chat app with the PubNub SDK? This demo shows how you can implement a chat application in fewer than 10 lines of JavaScript code.

PubNub allows you to create chat apps from scratch or add them to your existing applications. You can focus on creating the best user experience while PubNub takes care of scalability, reliability, security, and global legislative compliance.

Create 1:1 private chat rooms, group chats, or chats for large scale events, for a variety of use cases.

Demo

A hosted version of this demo can be found at https://pubnub.com/demos/10-line-chat/

Screenshot

Features

  • Communicates over the PubNub network - send a receive chat messages using the JavaScript SDK

Installing / Getting started

To run this project yourself you will need a PubNub account.

Requirements

PubNub Signup

Get Your PubNub Keys

  1. You’ll first need to sign up for a PubNub account. Once you sign up, you can get your unique PubNub Pub/Sub keys from the PubNub Developer Portal.

  2. Sign in to your PubNub Dashboard.

  3. Click Apps, then Create New App.

  4. Give your app a name, and click Create.

  5. Click your new app to open its settings, then click its keyset.

  6. Copy the Publish and Subscribe keys and paste them into your app as specified in the next step.

Building and Running

  1. You'll need to run the following commands from your terminal.

  2. Clone the GitHub repository.

    git clone https://github.com/PubNubDevelopers/JavaScript-Simple-Chat.git
  3. Navigate to the application directory.

    cd JavaScript-Simple-Chat
  4. Add your pub/sub keys to index.html, replacing the existing 'demo' keys

Contributing

Please fork the repository if you'd like to contribute. Pull requests are always welcome.