# TCP node session information

**URL:** https://discourse.nodered.org/t/tcp-node-session-information/15940
**Category:** General
**Created:** [26 September 2019 09:56 UTC](https://discourse.nodered.org/t/tcp-node-session-information/15940 "2019-09-26T09:56:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![SynAckFin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/synackfin/32/12468_2.png) [@SynAckFin](https://discourse.nodered.org/u/SynAckFin)
#### Post date: [26 September 2019 09:56 UTC](https://discourse.nodered.org/t/tcp-node-session-information/15940/1 "2019-09-26T09:56:02Z")

</div>

I have a couple of flows set up as follows:

```auto
     (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.

The `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 `MQTT` and `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:

> If `msg._session` is 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?
