Sending rtsp camera streaming over internet

Thanks krambriw, I was thinking to something similar to that, with a counter increasing/decreasing by messages sent from client side via mqtt. So I could start sending the video flow when the first client is connected, and stop it when the last one is disconnected. I already implemented something similar but using ui_control (all in local environment or even remotely but directly reaching the dashboard via IP, without remote mqtt, ecc). In that case it was easy to overcome the problem when you have a line disconnection, thanks to ui_control. In this case, wia mqtt, I'm thinking how to face this without complicate it too much

[{"id":"8a857234.e024","type":"ui_ui_control","z":"f68e9dd6.332eb","name":"","events":"all","x":100,"y":120,"wires":[["8ec1bf4d.4f579"]]},{"id":"8ec1bf4d.4f579","type":"function","z":"f68e9dd6.332eb","name":"Connection","func":"var Connected = context.get(\"Connected\");\nvar Connection = context.get(\"Connection\");\nif (msg.payload == \"connect\"){\n    Connected = true;\n    Connection = Connection +1;\n}\nif (msg.payload == \"lost\"){\n    Connection = Connection -1;\n    if (Connection == 0){\n        Connected = false;\n    }\n}\n\nif (context.get(\"Connected\")==false && Connection==1){\n    msg.connected = true;\n} else if (context.get(\"Connected\")==true && Connection==0){\n    msg.connected = false;\n} else {\n    msg.connected = null;\n}\n\ncontext.set(\"Connection\", Connection);\ncontext.set(\"Connected\", Connected);\n\nreturn [msg];","outputs":1,"noerr":0,"initialize":"// Connected\nif (context.get(\"Connected\") == undefined) {\n    context.set(\"Connected\",false)\n} else {\n    context.set(\"Connected\",context.get(\"Connected\"));\n}\n// Connection\nif (context.get(\"Connection\") == undefined) {\n    context.set(\"Connection\",0)\n} else {\n    context.set(\"Connection\",context.get(\"Connection\"));\n}\n","finalize":"","x":290,"y":120,"wires":[["93ed8d47.82bc6"]]},{"id":"93ed8d47.82bc6","type":"switch","z":"f68e9dd6.332eb","name":"","property":"connected","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":120,"wires":[["a10f874f.074bc8","e32c83cb.58612"],["2e184129.c194fe","d6769b7e.c043d8","74f23c32.730d04"]]},{"id":"a10f874f.074bc8","type":"link out","z":"f68e9dd6.332eb","name":"Start connection","links":["92d2f636.22b858","cb32c510.a6ffe8","4f5d2049.fe3ab","c5bb114.b19caf"],"x":655,"y":80,"wires":[]},{"id":"d6769b7e.c043d8","type":"link out","z":"f68e9dd6.332eb","name":"Stop conection - Video","links":["87da0239.7b80a"],"x":655,"y":140,"wires":[]}]

image