Latency on decies -> call function

I would like to know a bit more how this endpoint works, decies -> call function : `$ curl https://api.particle.io/v1/products/:productIdOrSlug/devices/0123456789abcdef01234567/gong\`
We use this endpoint in our system to open our lockers, but we notice that the latency from this endpoint is very unstable.
I would like to know if:
* Is your system waiting for device confirmation before sending the endpoint response?
* Do you have a timeout setting for dispatching commands to the device??
* If the device does not respond quickly, do you queue a task for this? If so, does this task have a timeout before dispatching the command?

Thanks

The API endpoint response does wait for a confirmation from the device. I believe the timeout is the 20 second CoAP timeout, but it may be slightly different, but in that ballpark. There is no queue, each request is either completed or abandoned by the timeout, however each request may be attempted more than once at the CoAP level, so a single packet loss will not cause the function call to fail.

The mobile network may cause delays; the longest is the original Electron and E-Series SIM which may cause the first packet to take 10 seconds, but the subsequent packets are fast. The EtherSIM should not have this issue, but network latency will be variable on cellular devices.

On the device, function call handlers are dispatched between calls to loop(), from the application thread. Because of this, if your code is blocking the loop for extended periods of time, it will affect the response from function call handlers.

1 Like