# Response to tcp subscription?

**URL:** <https://discourse.nodered.org/t/response-to-tcp-subscription/24229>\
**Category:** General\
**Created:** [4 April 2020 17:48 UTC](https://discourse.nodered.org/t/response-to-tcp-subscription/24229 "2020-04-04T17:48:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![knoepsche](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knoepsche/32/69450_2.png) [@knoepsche](https://discourse.nodered.org/u/knoepsche)\
**Post date:** [4 April 2020 17:48 UTC](https://discourse.nodered.org/t/response-to-tcp-subscription/24229/1 "2020-04-04T17:48:41Z")

</div>

![Flow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/1/c1456ea48798e2bca3c053488f82c2ef960d7274.jpeg)  
I use aTCP-IN NODE to listen for a client at port 8250.

If the client connects it sends me a subscription message  
with this message i get session-id, ip and port of the connection:

```auto
CasparCG Client : msg : Object
object
topic: "CasparCG Client"
payload: string
      SUBSCRIBE firstRD localhost:1880
ip: "::1"
port: 52170
_session: object
      type: "tcp"
      id: "3f457f08.b96ca"
_msgid: "9629e67a.355d28"

```

Now I want to start sending my own messages to the connection as a response. Therefor I use the TCP-OUT NODE with "Reply To TCP" activated. But where should I inject my message and should I use the session-id to address the client? If so, is the port then set automatically? I don't get it to work.

example:

```auto

[{"id":"1224d6b.ceffb29","type":"tab","label":"","disabled":false,"info":""},{"id":"6cc99649.7395c8","type":"tcp in","z":"1224d6b.ceffb29","name":"","server":"server","host":"","port":"8250","datamode":"stream","datatype":"buffer","newline":"","topic":"TCP Client","base64":false,"x":140,"y":200,"wires":[["89672f27.2a1fc"]]},{"id":"89672f27.2a1fc","type":"template","z":"1224d6b.ceffb29","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}}","output":"str","x":440,"y":200,"wires":[["c59737c8.1ef9c8","ffd6be18.512a2"]]},{"id":"c59737c8.1ef9c8","type":"debug","z":"1224d6b.ceffb29","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":870,"y":340,"wires":[]},{"id":"ffd6be18.512a2","type":"tcp out","z":"1224d6b.ceffb29","host":"","port":"","beserver":"reply","base64":false,"end":false,"name":"","x":780,"y":200,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [3 June 2020 18:02 UTC](https://discourse.nodered.org/t/response-to-tcp-subscription/24229/2 "2020-06-03T18:02:30Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
