Can an uplink/downlink operation be "atomic"?

I’m currently sending test data across from a custom board to my server using a webhook. All good so far. For my application it would be good if I can send a downlink message immediately to respond to an uplink. If I receive a request on my server and immediatly (within a second) send a downlink request to TTN, will this be forwarded on during the same uplink session? An example would be - device sends data including battery level. If level getting low, the server would want to send it a message to increase intervals between sending data.

So TL;DR Can a downlink be guaranteed (not withstanding signal issues) to be received by a node based on data it has just sent, in the same session?

Can it be guaranteed? No. But in most cases The Things Stack can reply to an uplink immediately.

The Network Server of The Things Stack creates a “downlink task” for each uplink. This task is scheduled some time (hard to give an exact number, because this accounts for network delay, gateway scheduling windows, etc.) before the RX1 downlink window that follows the uplink. When the task starts, it checks if there’s anything in the downlink queue, and if there is, it sends that.

If your device uses an RX1 delay of 5 seconds (the default for devices on The Things Stack Community Edition), your application should have enough time to schedule a downlink in response to the uplink. If your end device uses an RX1 delay of 1 second (which was the default in V2) your application may not have enough time to schedule a downlink in time.

1 Like

That’s great, thanks for the info!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.