The CoAP gateway serves as both a server and a client, facilitating communication with IoT devices through a single established connection. These devices act as CoAP servers, adhering to the OCF (Open Connectivity Foundation) specification for IoT devices.
The primary functions of the CoAP gateway are authentication and authorization of devices to access cloud services. Authentication is based on certificates, while authorization relies on JWT (JSON Web Token) tokens.
Devices connecting to the CoAP gateway must verify its certificates. The CoAP gateway offers three authentication methods:
After authentication, the CoAP gateway proceeds to authorize the device’s access to the IoT hub through the JWT token.
Authorization is essential for enabling communication with the IoT hub. The CoAP gateway authorizes devices to access the IoT hub using the JWT token. There are two ways in which the CoAP gateway can perform authorization:
This authorization is tied to the connection, meaning that if a device gets disconnected, it must be authorized again. Each command sent from the device to the IoT hub is associated with the device’s JWT token.
Once device authentication is completed, the synchronization of the device twin begins. The device publishes resources, and the CoAP gateway subscribes to these resources, forwarding any changes to the IoT hub to update the device twin.
During the device twin synchronization, the CoAP gateway subscribes to events from the IoT hub and translates them into CoAP commands to be sent to devices. If any event is awaiting the device’s online status, the CoAP gateway immediately sends it to the device.
plgd makes it simpler to build a successful IoT initiative – to create a proof of concept, evaluate, optimize, and scale.