This demo is a single HTML page. It loads the PubNub JavaScript SDK from the CDN and uses three calls: it adds a listener, subscribes to the 10chat channel, and publishes what you type when you press Enter. Every message, including your own, reaches the page through that subscription. The code panel next to the chat shows the same lines.
It's kept small on purpose. There are no user names, no message history, and no rooms. A new tab starts empty and only shows messages sent while it's open. The demo runs on PubNub's public demo keys, so anyone else on the demo channel can see what you send. To go further, follow the chat tutorial, which adds channel lists, typing indicators, and more.