Build

All PubNub SDKs Now Require Unique Identifiers (UUIDs)

2 min readKeith Lindsay on Mar 4, 2022
Try PubNub Today

Free up to 1MM monthly messages. No credit card required.

Subscribe to our newsletter

By submitting this form, you are agreeing to our Terms and Conditions and Privacy Policy.

PubNub SDKs now require UUIDs, which will enable developers to make better use of their user data to enhance their apps and improve the user experience.

The cautionary tale

Our tale begins with a developer trying to rush to prototype their chat application, they found PubNub so easy to get started they skimmed over the documentation and didn’t realize that unique identifiers for each of their application instances would be generated every time the application started.

Being on the MAU pricing plan, which charges for each user, this was a recipe for disaster. Their bill ballooned far beyond their actual usage. If only they had set the UUIDs in their application instead of using the default random ID generator.

The solution

After hearing this cautionary tale, our team decided to fix this problem by enforcing our best practice policy of requiring the UUID to be set. Previously, if a UUID was not set, PubNub SDKs would randomly generate on when connection was created to PubNub. Often, this would inflate the user numbers and cause customers to be billed more than our actual usage. 

Now when our developer tries to implement PubNub without setting the UUID, they will get an error until they generate one. This allows them to identify each user in their own unique way and ensure that events and messages generated by the user are published to the correct channels.

Identity is one of the key components of a Virtual Space, so by requiring our developers to uniquely identify each, we empower them to utilize the data generated by each user to enhance their application and deliver the best experience to their end users. 

How do you generate your own unique identifier?

Every program language has built in id generators that can be used, however, one of the most common ways to create an identifier for a specific device is to create a hash of something unique to the device. For example, as long as it can’t be reversed, hashing the MAC address of the device or the email address of the user can be a good way to generate a unique identifier that is always associated with the device or the user.

To generate a UUID for each language, you can visit this page. And if you're not already building with PubNub but are looking to get started, you can try our APIs for free here.

More from PubNub

Can Empathy Exist in the Metaverse
News May 16, 20221 min read

Can Empathy Exist in the Metaverse

A roundtable discussion led by PubNub’s COO, Casey Clegg, exploring the topics of what it means to be human in a virtual world.

PubNub Staff

PubNub Staff

How to Advance Telehealth and Virtual Care Technologies
News May 2, 20221 min read

How to Advance Telehealth and Virtual Care Technologies

Dr. Joe Kvedar, Chair of the Board for the American Telemedicine Association, joins our COO, Casey Clegg, to discuss why...

PubNub Staff

PubNub Staff

Another Step Towards Data Security: ISO-27001 Implementation
BuildMay 2, 20221 min read

Another Step Towards Data Security: ISO-27001 Implementation

Today, we are glad to announce that we are currently in the process of implementing ISO-27001 security standards.

PubNub Staff

PubNub Staff