How long can I hold a socket open?

http
#1

We are using HTTP to transmit REST state-updates. Our firmware is working, but it is slow when transmitting several measurements back-to-back because we perform the entire TCP-socket-open/close dance for every transmitted state.

Now, I want to use a single socket connection to transmit repeated HTTP POST for device state.

If I do something like holding the socket open indefinitely until your server closes it, is that acceptable? Or is that something you discourage?

#2

Hello @Alexander_Farley!

The HTTP Node allows you to set a custom timeout, but the maximum and default timeout is 30 seconds. Using the HTTP Node will put the values on the payload, so a Device State Node would also be needed in the workflow to post device state.

A different approach would be to use MQTT (which may not be feasible for your use case) which allows for constant state reporting. If MQTT could work for you, the overview can be found here.

Let me know how I can help further,
Julia