MQTT Gateway API Reference
Last updated
Last updated
The Gateway is a special type of device in JIoT that is able to act as a bridge between external devices connected to different systems and JIoT. Gateway API provides the ability to exchange data between multiple devices and the platform using single MQTT connection. The Gateway also acts as a JIoT device and can leverage existing to report stats, receive configuration updates and much more.
The API listed below is used by JIoT open-source IoT Gateway.
Please refer to generic to get information about data format, authentication options, etc.
In order to inform JIoT that device is connected to the Gateway, one needs to publish following message:
where Device A is your device name.
Once received, JIoT will lookup or create a device with the name specified. Also, JIoT will publish messages about new attribute updates and RPC commands for a particular device to this Gateway.
In order to inform JIoT that device is disconnected from the Gateway, one needs to publish following message:
where Device A is your device name.
Once received, JIoT will no longer publish updates for this particular device to this Gateway.
JIoT attributes API allows devices to
Upload client-side device attributes to the server.
Request client-side and shared device attributes from the server.
Subscribe to shared device attributes from the server.
Publish attribute update to the server
In order to publish client-side device attributes to JIoT server node, send PUBLISH message to the following topic:
where Device A and Device B are your device names, attribute1 and attribute2 are attribute keys.
Request attribute values from the server
In order to request client-side or shared device attributes to JIoT server node, send PUBLISH message to the following topic:
where $request_id is your integer request identifier, Device A is your device name, client identifies a client or shared attribute scope and key is the attribute key.
Before sending PUBLISH message with the request, client need to subscribe to
and expect messages with result in the following format:
Subscribe to attribute updates from the server
In order to subscribe to shared device attribute changes, send SUBSCRIBE message to the following topic:
and expect messages with result in the following format:
In order to publish device telemetry to JIoT server node, send PUBLISH message to the following topic:
Message:
where Device A and Device B are your device names, temperature and humidity are telemetry keys and ts is unix timestamp in milliseconds.
In order to subscribe to RPC commands from the server, send SUBSCRIBE message to the following topic:
and expect messages with individual commands in the following format:
Once command is processed by device, gateway can send commands back using following format:
where $request_id is your integer request identifier, Device A is your device name and method is your RPC method name.
MQTT transport can be fully customized for specific use-case by changing the corresponding module.