VOGO Voice – Knowledge Base

PubNub

Estimated reading time: 3 min

Database Type: Pub/Sub, IoT

Connector Supports: Write only

Introduction

PubNub powered by a secure global Data Stream Network (DSN) is an infrastructure as a service company (IaaS) that enables real-time communication by aiding to develop real-time web, mobile, and Internet of Things (IoT) applications. The foundation of this programmable network is Publish/Subscribe(Pub/Sub) model for real-time data streaming and device signaling which helps to deliver data/messages to global audiences in less than a quarter second. 

VOGO Voice platform leverages only the Publish service hosted by PubNub Network, thereby supporting a write-only client to publish data to a specific channel through the instance of a PubNub connector that has been created.

Prerequisites

Channel name, Publisher key, Subscribe key

Anatomy of Settings

Defining Settings values for adding a PubNub Account                  

Name: It refers to the name assigned to the instance of the connector created.

PunNub API key sets help in the first level of partitioning data between PubNub accounts. Each key set includes a publish key, a subscribe key, and a secret key. The users can create key sets from their admin portal through the PubNub Admin Dashboard. 

Publisher key: As the VOGO Voice platform supports write-only client, it is mandatory to provide a valid publish key associated with a specific channel to enable the activity of publishing/sending messages to all the subscribers of the respective channel.

Subscribe key: The subscribe/read function serves the purpose of subscribing to a specific channel in order to listen to the messages published on the channel. Though the function is not supported by the VOGO Voice platform, it still requires a subscribe key at the time of initializing a PubNub object.

Note: It is not necessary to subscribe to a channel in order to publish to that channel. But for a client who is granted access rights to publish to a channel will need to initialize with both the subscribe key and the publisher key. 

Cipher key: This cryptographic key if passed while initializing your PubNub object will ensure the encryption of your message payloads before being pushed onto the PubNub Data Stream Network. Being a symmetric key, the same key initiates both encryption and decryption. 

Authentication Key: Enabling PubNub Access Manager (PAM) will aid in generating a custom authorization key that is purposed to control a user’s access rights to channels and messages thereby extending PubNub’s existing security framework. The key enforces secure access to channels by dictating permission levels for users to have read, write, or read-write privileges to individual channels. 

UUID: This parameter is a unique ID used to identify the client which in turn helps in accurate device counting. When a PubNub instance is instantiated without providing a UUID, the PubNub SDK automatically generates a new UUID. Therefore instantiating a PubNub instance twice in a single day for one device will generate 2 different UUIDs for that single device. To avoid this, persist the UUID to be retrieved and reused. 

Origin: It refers to the fully qualified domain name of PubNub origin. By default, this value is set to ps.pndsn.com but it should be set to the appropriate origin specified in the PubNub Admin Portal.

Note: The aforementioned keys and values are provided by the PubNub account holder. 

Disclaimer: The keyset/private information is encrypted when saved within the VOGO Voice platform for your security.

Connector Usage

Now that a connector is established it can be used within any interaction flow. Each usage of the connector will allow different configurations to retrieve different results. Those settings can be either static or dynamic based on the needs.

Anatomy of Configuration

Defining Configuration Values for a PubNub connector

Name: The name assigned to identify the connector and the results data. The assigned name is used every time the connector is called to action through the components in the interaction builder platform. 

Channel: Specify the name of the channel to which you need to publish messages. In PubNub Network messages are sent and received on channels. Channels do not have to be defined in advance as they are automatically created by the act of publishing a message onto the channel. 

A channel is namespaced by the subscribe and publish keyset. For example, a message published with a PubNub instance defined against a specific keyset on channel1 can be received only by the subscribers defined against the same keyset on channel1. 

Note: The best practice is to keep the channel name as short as efficiency and utility allows since the text length of the channel name is counted as part of the entire message. Unpermitted characters in a channel name are comma ( , ), slash ( / ), backslash ( \ ), period ( . ), asterisk ( * ) and colon ( : ) 

Message: A PubNub message is comprised of a channel and its associated data payload. The data payloads are actual packets of data published to channels that can contain any serializable data, including Objects, Arrays, Numbers, and Strings.  

🖍 Note: The maximum size for any single message is 32KB which includes the channel name. 

To know more about the message design considerations visit  https://www.pubnub.com/docs/nodejs-javascript/api-reference-publish-and-subscribe

Store in History: Click the checkmark box of Store in History in order to store the published messages in the channel so that they can be retrieved at a later time.

Meta: While publishing a message on a given channel, it is possible to add tags or metadata that further define the message. The subscribers can opt to filter and return messages containing specific metadata. The meta dictionary is a plain text and will not be encrypted when pushed over to PubNub Network. Therefore it is important to include information that is not confidential.

Caching: To know about caching, click here.

  • To access the tutorial on posting messages using PubNub, click here.
Tags:
Was this article helpful?
Dislike 0
Previous: CARTO
Next: Airtable