I am implementing a light controlling with MQTT/node which consists of some elements mainly these: device (behind a NAT), server (mqtt/broker), client (web browser)
Part of the architecture/process I came up with was: The device needs to open a socket with the server and keep it open (and not the other way because of NAT), so whenever the client sends a control command to the server, the server sends it to the device via the opened websocket.
So my broader question would be: How are device-behind-NAT/server connections handled normally in IoT?
NOTE: I’ve seen lots of questions explaining the case when a device writes to the cloud and then a client reads from it, which doesn’t need the socket open all the time (just when the device writes) But haven’t seen the case when the server/client want to write to the device (from outside the NAT)