Soracom Beam Supports New PubNub MQTT Interface

Soracom - PubNub

We’re very excited to announce that the Soracom Beam protocol translation service supports the new PubNub MQTT interface announced today.

Soracom - PubNub

While PubNub has supported MQTT for some time, per today’s announcement, PubNub’s expanded Data Stream Network features are now also available to PubNub customers with MQTT devices. Given the value of MQTT for IoT device development, this is a really big deal, and it was our pleasure to serve as a launch partner for this new feature.

What is PubNub?

PubNub’s real time network provides the infrastructure and APIs for low-latency communication across IoT deployments of any size, anywhere in the world. The PubNub Data Stream Network (DSN) lets developers serve dynamic content to and between devices and even leverage pre-built integrations with popular IoT APIs. For IoT developers, this means you can connect even the smallest, most constrained devices using the IoT-optimized MQTT protocol.

What is Soracom Beam?

Soracom Beam (Beam) is a service that enables you to offload the high-load processes related to device encryptions into the cloud. It supports generic protocols like HTTP/MQTT/RAW TCP socket/RAW UDP packet.

SORACOM Beam Diagram

Soracom Beam Diagram

Why use Beam with PubNub?

To use PubNub MQTT interface, a device will need to build the ClientID string by concatting the publish key and subscribe key and client UUID with “/”.

publish_key + "/" + subscribe_key + "/" + client_uuid

This would usually require hard-coding your credential in the application code running on the device. This is very secure, but not very flexible. Imagine if you already deployed your devices all over the world and need to change that credential?

In a case like this, Beam comes to the rescue. Devices should only know the Beam entry point address (beam.soracom.io) and authentication is properly handled behind the curtain. You just update the credential in web based user console and it is applied to new connections right away.

How to use Beam?

To use Beam, devices first need to connect using SORACOM’s IoT-optimized SIM.

Once you have connected your device , you can configure your Beam setting by modifying the SIM configuration group (If you did not create a group for your SIM upon registering, you can create a new group and tie it to the SIM).

Open the group and open Beam setting, select Type in Destination as “PubNub” and click on + in “Credentials Set” section.

MQTT configuration

You will be asked to provide Publish Key and Subscribe Key for your PubNub key. Click on “Register” once you filled all required fields and click on “Save” in the MQTT configuration window.

Registering Credentials

Now you are all set.

How to send/receive data?
When your device is connected using the Soracom SIM, you can just publish a message to the Beam endpoint without authentication like below.

$ mosquitto_pub -h beam.soracom.io -t beam -m 'Hello PubNub from Beam!'

You can use PubNub debug console to check if the data is arrived.

PubNub Debug Console (RECEIVE)

If you want to send data to devices, the devices should subscribe to a topic. When you send data via debug console like below,

PubNub Debug Console (SEND)

Device can receive data like below.

$ mosquitto_sub -h beam.soracom.io -t beam
{"text":"Hello Beam from PubNub!"}

What will you make?

It is very cool to integrate your web app or mobile app with embedded device. Please let us know if you make something cool!

For more information about PubNub DSN, catch the PubNub Webinar on Leveraging PubNub for IoT Machine Learning and Predictive Maintenance February 8th at 9:30PDT.