Mobile Group Chat with One Line of JavaScript

0 MIN READ • Jun 5, 2014

Waving Hand

Good News! We've launched an all new Chat Resource Center.

We recommend checking out our new Chat Resource Center, which includes overviews, tutorials, and design patterns for building and deploying mobile and web chat.

Take me to the Chat Resource Center →

One of our first and most popular blog posts is Chat in 10 Lines of Code. In my constant quest to outperform PubNub founder and CTO Stephen Blum, I decided to challenge myself to create a mobile group chat demo that was responsive and ready for mobile in just one line of JavaScript.

mobile group chat

Yes, that's right…with one line of code you'll get a mobile group chat app that looks like this:

Today, I’m happy to announce the release of the PubStrapChat jQuery plugin. With this library you can add mobile group chat to your site, mobile or otherwise, with a single line of javascript:

The chat box drops right into any div on your page. It's fully responsive and will look great on any mobile site with Bootstrap. Or, you can ditch Bootstrap and style it yourself.

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

All the code you need to get started and an example is below:

See the Pen PubStrapChat by Ian Jennings (@ianjennings) on CodePen.

The PubStrapChat plugin can be extended to use your own PubNub API keys and even your own user authentication system. You can configure the plugin by using an options object.

Check out the documentation to get it working with your custom user system. You can even set it up to use third party authentication systems like Facebook.

Latest blog posts

AI
Oct 7, 2026

Why MCP Alone Isn’t Enough for AI-Assisted Real-Time Development

Discover why Model Context Protocol (MCP) alone isn't enough for building production-ready real-time apps, and how combining MCP with engineering guidance (PubNub Skills) ensures robust architecture.
Ginni Kakkar
Ginni Kakkar
Sports Media Engagement
Oct 1, 2026

The ultimate guide to fandom engagement in 2026

Learn the value of fandom engagement platforms and how brands monetize direct-to-consumer proximity, real-time messaging, and tiered subscriptions.
Daryl Pereira
Daryl Pereira
AI
Sep 30, 2026

AI Coding One Year Later: A Product Manager's Lessons

Product manager Cres Hay looks back on a year of AI coding: faster prototypes, narrower scope, and why human judgment still decides what is worth building.
Cres Hay
Cres Hay