Babel

This message will self-destruct in five seconds. Babel is an open source chat widget and API built on the PubNub Data Streams Network. Babel lets you send self-destructing messages and helps facilitate public key exchanges.

Chat

Author:

Larry Wu

Github DownloadTutorial

Self-Destructing Chat in 2 Steps

Build your chat to use encrypted, self-destructing messages by simply:

  • Importing the Babel, PubNub, and Cryptico SDKs

  • Initializing an instance of Babel

It’s as simple as that to get started! For additional details to build this app, check out our five-part blog series.

<script src="pubnub.js"></script>
<script src="cryptico.js"></script>
<script src="babel.js"></script>

<script>
var babel = new Babel('me');
</script>

Public Key Exchange

Babel uses 1024-bit RSA encryption to secure every message that it sends. You can get an object of all users and their respective keys using the listUsers() call or get your own Cryptico RSAkey with myKey().

Sending and Receiving Messages

The basic building blocks to sending and receiving Babel messages are:

sendMessage(recipient, message, ttl) This sends the message string to the recipient provided. The ttl specifies the number of seconds the message will be available before it self-destructs.
returnMessages() This call returns all messages that haven’t self-destructed yet.
onRecieveMessage(callback) This allows you to specify a callback that should be called when you receive a message.

Presence

PubNub Presence allows you to detect when users enter or leave your app. With Babel, you can find all users currently connected to your chat using the listUsers() call. The callback within onPresence(callback) will be called whenever a user joins or leaves. For a more detailed overview of the Babel API, check out the README on GitHub.

Blog Posts

Features Used

Feedback & Support

Need help? Contact PubNub Support.

More Demos for you

10CHAT

10CHAT

A simple chat app powered by PubNub.

Learn more
Support Chat

Support Chat

Support Chat lets you build effective support chat to increase customer...

Learn more
Team Chat

Team Chat

Beautiful, responsive group chat demo experience for collaborative and...

Learn more

Talk to an expert

Contact Sales