Like the other platforms, Kii Cloud SDK for Thing provides the push notification feature. This page explains how you can leverage the push notification with Kii Cloud SDK for Thing.
We assume that you already have the basic understanding of the push notification explained in Managing Push Notifications for the Kii Cloud SDK.
Kii Cloud SDK for Thing allows you to implement push notification using the MQTT protocol. See MQTT Protocol for an overview of push notification using the MQTT protocol.
While available functions are different from those in the other SDKs, things can make use of the push notification feature of Kii Cloud.
Thing status (online and offline)
A thing can have one of the following states:
Online: A thing is "online" if there is an MQTT connection established with Kii Cloud (i.e., it can receive an MQTT push notification from Kii Cloud).
Offline: A thing is "offline" if there is no MQTT connection established with Kii Cloud (i.e. it cannot receive an MQTT push notification from Kii Cloud).
Click the links below to see how you can check the thing status.
When a thing subscribes to a bucket or topic, the thing itself becomes a subscriber and an entity that receives the push notifications.
When leveraging the push notification features with a smartphone or tablet, a device is registered with a target user being logged in. During the registration, an access token of this user is sent to Kii Cloud. Kii Cloud then sets the user as a subscriber and the device as an entity that receives the push notifications.
The story is a bit different when leveraging the push notification features with things. A thing registers itself with its access token. As a result, both the subscriber and the entity that receives the push notifications become the thing.
The following figure illustrates how the subscription by users, devices, and things is handled. Users and things can subscribe to the same bucket at the same time. A push notification is sent to all devices owned by the subscribers and all things that are subscribing to the bucket when an event occurs on the bucket, regardless of the underlying push technologies.
Push notification features
Kii Cloud supports three types of push notifications namely: Push to App Notification, Push to User Notification and Direct Push Notification.
The following summarizes how each feature works with things.
Push to App notification
A bucket in a Thing scope can be subscribed to by the thing and users (who have the privilege to do so).
Push to User notification
A thing can create a topic in its Thing scope. The thing and users (who have the privilege to do so) can subscribe to the topic.
Direct Push notification
Things cannot receive the Direct Push notification.
Click the links below for sample code.
Client SDK REST
Development and production environments
You can use the development and production environments with things. See Development and production environments for more details.
Like the other SDKs, you will select the environment to use (development or production) in the Kii Cloud SDK for Thing when you register a thing to Kii Cloud.