When a device is connected to coap-gateway and signed in, it will send a ping (a signal to check the connection) every 20 seconds. This delay is set by a defined macro PING_DELAY. After sending a ping, the device will wait for a response (pong) for 1 second. If a response is not received within this time, the delay between pings will be decreased to 4 seconds. If the device fails to receive a response for six consecutive pings, it will initiate a reconnect process.
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.
plgd makes it simpler to build a successful IoT initiative – to create a proof of concept, evaluate, optimize, and scale.