# NodeRed TCP OUT Node Success Response

**URL:** https://discourse.nodered.org/t/nodered-tcp-out-node-success-response/81256
**Category:** General
**Created:** [13 September 2023 03:36 UTC](https://discourse.nodered.org/t/nodered-tcp-out-node-success-response/81256 "2023-09-13T03:36:25Z")
**Posts on this page:** 1
**Showing post:** 14

<div class="post-metadata">

### Author: ![shershah](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@shershah](https://discourse.nodered.org/u/shershah)
#### Post date: [13 September 2023 11:00 UTC](https://discourse.nodered.org/t/nodered-tcp-out-node-success-response/81256/14 "2023-09-13T11:00:59Z")

</div>

> [quote="Steve-Mcl, post:13, topic:81256, full:true"]  
> Sorry, that sample flow is not entirely clear what you are expecting to send to MQTT AFTER success/fail.
> 
> For example, you have not created a `tcp-in -> send_fake_but_valid_data ->tcp-out`

**I am sending back the exact same request json with additional variables of successCode in case of success and errorcode in case of error.**  **I have added sample response json in function node**

> [@shershah](#):
>
> My Flow is  
> MQTTBroker -\> TCPServer -\> MQTTBroker

Good - ok. I understand that.

> [@shershah](#):
>
> So I am getting a list of sensors and parameters list through mqtt broker. I need to update the sensor

> If you get a "list of sensors" then how do you "update the sensor"?  
> What is the relevant parts of the incoming data?  
> What is the data to be sent to TCP (an exact example please)  
> Are you expecting the each sensor to go to 1 TCP server or different TCP servers?

**1. After getting the request json I am updating the sensor through TCP protocol. I will have predefined tcp nodes and based on sensor id , I will send response to tcp server.**  
**2. I will be sending opValue to tcp server based on sensorId. all parts are relevant and need to send back same request json with success code.**  
**3. opValue**  
**4. Multiple sensor can have same server or multiple. It depends but currently as first step I am trying to update the same tcp server.**

> [@shershah](#):
>
> After updating the sensor I want to send the response back with the success, error status.

> What EXACTLY is "the response" a string of "ok" a JS object containing xyz?  
> please add an example to your demo flow.

**TCP server may or maynot send the response. If Server update is successful and I dont get any error, I need the send the same request json with additional parameters succiessCode and ErrorCode in paramList.**

```auto
**Response JSON**
 **{**
**"sensorList": [**
 **{**
 **"sensorId": "6131a8d409e2162ea1df532e",**
 **"protocol": "tcp",**
**"paramList": [**
 **{**
 **"paramName": "voltage",**
 **"opValue": "220",**
 **"successCode": "",**
 **"errorCode": ""**
 **}**
**]**
 **},**
 **{**
 **"sensorId": "6131a8d409e2162ea1d423432e",**
 **"protocol": "tcp",**
**"paramList": [**
 **{**
 **"paramName": "temp",**
 **"opValue": "220",**
 **"successCode": "",**
 **"errorCode": ""**
 **}**
**]**
 **}**
**]**
 **}**

```

* * *

> NOTE: I realise that some of the answers may already be posted in previous posts but I dont want to assume anything.  
> [/quote]

**Thanks for giving your time in understanding and trying to help. I am blocked and needs to get it done asap.**

---

_[View the full topic](https://discourse.nodered.org/t/nodered-tcp-out-node-success-response/81256)._
