How To Guide: PubNub Connector Plugin

 

June 14, 2016  |  By Dale Rankine

pubNub_logoPubNub is a secure global Data Stream Network (DSN) and easy-to-use API to connect and manage realtime, bi-directional communication for IoT, mobile and web devices.

 

With over 70 SDKs for every platform, 250ms worldwide data transfer times, and scalability for hundreds of millions of devices, PubNub enables Reekoh developers to easily connect and operate realtime applications and IoT devices without having to build and maintain backend infrastructure. PubNub supports over 2,000 customers globally, touching over 330 million devices per month across 15 data centers (with 250ms latency and 99.999% SLAs).

The PubNub Connector Plugin for Reekoh enables the user to stream device data to the PubNub platform and make use of their Publish/Subscribe infrastructure.

 

Let’s follow these basic steps to see how the plugin works in the Reekoh platform:

  1. Register a device
  2. Install plugins
  3. Build a topology
  4. Connect to a gateway
  5. Send and Verify data to PubNub

 

First, you need to login to your Reekoh account. Once you’re in the Instance Manager, navigate to Devices > Register New Device and then complete the form that comes next. You can also use an existing registered device, if you have one.

N1

 

Next is to install the plugins we’ll be using: PubNub Connector and MQTT Gateway (this will enable you to ingest device data via MQTT protocol). Locate these plugins in the Plugin Store, and then install them to your instance.

N1

 

After you’ve installed your plugins, setup your topology by navigating to Topologies > Build New Topology and then complete the form that comes next.

N1

 

Once your topology is done, configure your installed plugins by locating their respective categories in your topology. For example, the PubNub plugin must be configured in the Connector category. Click Configure New, and then complete the form that comes next.

N1

N1

 

You will be required to provide the Publish and Subscribe keys. To obtain these keys, log in to your PubNub account. Once you’re in the admin dashboard, scroll down the page to find the application you want to send data to. Click on the application name to view your API keys.

N1

 

Navigate to Keys Info, then click on your Application API keys.

N1

 

Once you have your API keys, go back to the Configure Connector Plugin page in your topology and proceed on completing the form.

N1

 

After you’ve configured both plugins, you should be able to see them in your topology.

N1

 

For you to send device data to the PubNub platform, download or install any MQTT simulator from the Chrome Web Store. We’ll be using MQTTLens for this example. Open the application, and then create a connection for your device by completing the form that pops out.

N1

N1

 

Once a connection has been established, you need to subscribe to your data channel in order to view the data coming from your device. Go back to your PubNub account and then navigate to Debug Console. Complete the form that comes next (make sure the Default Channel you supply here is the same that you’ve provided when you configured your Connector plugin), and then click Add Client.

N1

 

After you’ve subscribed to your data channel, go back to your device connection in MQTTLens. Type or paste your JSON device data in the Message field; then supply any Topic for your data. Click Publish to send it to the PubNub platform.

N1

Check your device data if it has been received by going back to your client console in PubNub. You should be able to see the sent data on your channel.

N1

 


Additional Links: