Once a device is connected to the coap-gateway and signed in, it sends a ping signal every 20 seconds to verify the connection. After sending a ping, the device waits for a response (known as pong) for 4 seconds. If no response is received during this time, the delay between pings is decreased to 4 seconds. If the device misses six consecutive pings without any response, it will initiate a reconnect process. The behavior of this process can be configured through the set callback function using oc_cloud_set_keepalive.

The CoAP gateway also has a keepalive function to check the connection with the device. The interval for sending pings and the timeout for waiting for a response (pong) can be configured through a variable in the CoAP gateway’s helm settings coapgateway.apis.coap.keepAlive.timeout. By default, this interval is set to 20 seconds. If the CoAP gateway does not receive any data from the connection for the set ping interval, it will send a ping to the device. If the device does not respond within the timeout period (coapgateway.apis.coap.keepAlive.timeout), it will be disconnected.

Jan 10, 2023

Get started

plgd makes it simpler to build a successful IoT initiative – to create a proof of concept, evaluate, optimize, and scale.

Get Started Illustration Get Started Illustration