IN THIS ARTICLE
PubNub’s framework dramatically reduces your coding when building chat based collaboration apps. Tasks like sending and receiving data take only one function call. And your code instantly updates in web and mobiles apps, for rapid testing.The network infrastructure and scaling is taken care of for you so you spend time building your app, not infrastructure.
Chat Input ( try it on your mobile device too! ):
The basic send “publish” functionality with sending a message for simple chat apps:
The basic receive “subscribe” functionality to receive messages in a simple chat app:
Build Realtime Chat Apps Fast and Cut Development Time
PubNub’s framework dramatically reduces your coding. Tasks like sending and receiving data take only one function call. And your code instantly updates in web and mobiles apps, for rapid testing.
The network infrastructure and scaling is taken care of for you so you spend time building your app, not infrastructure.
Develop Realtime Chat Across Platforms
PubNub has the only complete solution for developing across platforms and OS versions.You can write once and build Web, iOS and Android Apps. PubNub will automatically broker your connections from web to phones to tablets to everywhere.
How Chat with PubNub Works
PubNub is a global Data Stream Network that makes it easy to develop and deploy realtime mobile and web apps, using just two functions (Publish and Subscribe) to pass data back and forth in under 1/4 second. These functions are available free in PubNub’s Realtime Software Development Resources, Tutorials & SDKs for over 50 programming languages and frameworks. These simple APIs push messages onto the PubNub Network, which has 14 Points of Presence around the world for low latency and reliable connectivity everywhere. Since PubNub works on just about every conceivable device, it’s now possible to build powerful one-to-one and many-to-many chat applications that work on every device, everywhere in the world.
PubNub offers many optional layers of security giving you the easy-to-use tools necessary to deploy an encrypted chat solution that incorporates powerful features like non-repudiation and secure data archival for audit purposes, where needed. PubNub also provides a plug-in replacement for Google GCM Android Cloud Messaging Notifications and Apple APNS Push Notifications, allowing you to “wake-up” a smartphone with a secure message without leveraging unsecured Apple and Google APIs.
PubNub’s secure features for chat include:
- Built-in AES256 encryption libraries, so chat messages are encrypted at the source. AES keys are not generated or kept by PubNub, so the data is only ever visible by the devices which contain the AES keys.
- SSL encryption to ensure the message envelope is encrypted to/from the PubNub Data Stream Network.
- PubNub Access Manager allowing fine-grain read/write privileges on every chat “channel”, giving you the simultaneous ability to have secured one-to-one chat and unsecured group chat sessions within the same app.
- Ability to dynamically create random chat “channels”, ensuring the anonymity of users and their locations, even when they are in a private chat together. The user’s IP address and other identifying information is never exposed.
Chat Presence Detection & Participant List using PubNub Presence
A common question is “who’s listening in my chat rooms“? Most realtime apps want to show their end-users who else is there (i.e. subscribing) to a channel. This functionality is a common requirement in chat apps (think about the green icon that appears next to someone’s name), as well as within game chat room lobbies and many other similar apps. Using PubNub Presence, you can instantly detect when users enter/leave your app when they disconnect from the network. PubNub Presence is easy to use: every chat channel contains an optional “presence” channel on which “connect” and “disconnect” events are sent. This provides you an easy way to display icons when a user is in a chatroom, and remove those icons as soon as a user disconnects.
Presence gives you more information that just connect/disconnect events. Presence also gives you a realtime count of the number of people in a chatroom (i.e. “subscribed to a channel”). And, with PubNub Presence, you can pass in a user ID and PubNub will show a list of all chatrooms a user is connected to. This gives you an easy-to-use way to let users “find” their friends in within an application that may contain many chatrooms, games, or collaboration spaces. This presence data is available to end-devices, as well as your servers.
Check out lots of interesting ways to use presence: Five Ways You Can Use PubNub Presence.
Chat History Storage & Playback