I have a couple of flows set up as follows:
(TCP Client) -----> (Client Function) -----> (TCP Client Out) (MQTT) ----/ (Inject) ---/ (Status) --/ (TCP Server) -----> (Server Function) ------> (TCP Server Out) \--> (MQTT)
The client is connected to a smart thermostat and the server processes data from the outside world. The only communication between the two is via MQTT.
Inject node is used to periodically send a request to the thermostat otherwise it will close the connection.
The problem I have is that the
Client Function has no knowledge of the
TCP Client session information until it receives at least one packet, At that point it can save it and then use it on messages generated from
Inject. Unfortunately it will not receive data until it has sent something and if it sends something without the
msg._session set then, according to the documentation:
msg._sessionis not present the payload is sent to all connected clients.
This means that the first message intended for the thermostat will also get sent to
TCP Server Out.
The only solution I can see is for the
Client Function to somehow get the session information from
TCP Client after the client has connected.
Is there any way to do this?