4 min read
on May 21, 2014
Private realtime messaging app Talk.co used PubNub Access Manager, data streams, and presence to build their realtime messaging layer.


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 →

Talk.co Builds Realtime Messaging Layer with PubNubTalk.co is a cross-platform private realtime messaging app for organizations that enables coworkers to instantly and securely communicate via web and mobile (Native iOS and android). The core messaging in the app includes both 1-to-1 and group chat, and allows users to share content (photos, videos, and links). Additionally, the app includes realtime alerts and notifications for both online and offline users.

To enable teams to communicate quickly, efficiently and securely, Talk.co needed a scalable realtime messaging transport layer for all communication in their app. This messaging transport layer would power their realtime chat service, syncing data between devices, as well as alerts and notifications.

Skipping the build vs buy discussion

“We went with PubNub right from the start. We knew that PubNub could accelerate our time to market with a solid messaging transport layer solution.” said Karl Kastan, Director of Engineering at BranchOut, makers of Talk.co.

In many cases, development teams first elect to try to build out a realtime infrastructure on their own. After discovering that a custom, in-house built solution is daunting both to build and deploy, development teams often turn to a data stream network service provider. Talk.co skipped the build step and went straight to using a data stream network service provider, picking PubNub.

“We assessed our alternatives and quickly realized that there was no reason to re-invent the wheel. By leveraging PubNub’s existing infrastructure, we were able to focus on our product features and design, instead of trying to build the same reliable service already offered by PubNub.”

Creating a realtime messaging layer

Creating a realtime messaging layer

PubNub powers Talk.co’s realtime messaging layer on both the web and native mobile apps, and syncs all messages between all devices. PubNub Data Streams is used to power realtime chat and messaging in both the web and mobile apps, including both 1-to-1 chat and group chat (using broadcast messaging). Messages are sent and synced between web and mobile devices in realtime. Additionally, Talk.co uses PubNub Presence to allow users to see who is available to chat and who has left the application.

“We use PubNub as the transport layer for the realtime activity across our app. This includes syncing from native (mobile) to desktop or vice versa. That is a major undertaking which PubNub has solved for us.”

Access Manager and per-user channels

Access Manager and per-user channelsOn the backend, Talk.co uses per-user channels, where each user is assigned to their own channel. This allows users to communicate with one another individually or to specific groups in a secure fashion, as well as calling a here_now function for Presence. Overall, it enables the app to compute what a user can see, then distributes messages through individual user channels. All this uses PubNub Access Manager (PAM).

PAM grants and revokes publish and subscribe permissions and access to individual users, devices, or channels. This gives the app control over who can post, see messages, share content, etc.

“We use a per-user channel on our backend. When an event occurs, whether triggered directly by a user or as a notification from PubNub, we compute who can see what, then fan out the messages through individual user channels to the recipients via PubNub. It is the [PubNub] Access Manager which allows us to do this in a secure manner. A good example of this is Presence: a person comes online, we know who his contacts are, and we notify each of his contacts (and ONLY his contacts) that this individual has come online.”

Realtime Alerts and Notifications

To further build upon their realtime messaging infrastructure, Talk.co implemented a realtime alerts and notifications service into their app. After finding deliverability issues with GCM, the development team swapped their notification system out with PubNub. For Android devices, the app listens to the PubNub channel and sends the notification via PubNub.

All Communication In One Place

Talk.co is an efficient and secure way for teams to communicate and collaborate. With PubNub realtime messaging, data is sent in under a ¼ second, and using PAM, the app is in complete control over what channels users can join and leave.

“The interesting thing with our system is when someone communicates on Talk.co, they have a potentially every expanding graph of people to chose from to talk to. It’s not just a static subset of groups we have to define security around, rather an ever changing graph of contacts and within that a changing and dynamic set of subgroups. PubNub has been a great partner to help us build a reliable, scalable enterprise messaging solution for our users,” said Kastan.

More From PubNub