# Question about tcp connection status and inject node during dashboard start

**URL:** https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823
**Category:** General
**Created:** [23 September 2026 12:58 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823 "2026-09-23T12:58:43Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![robt](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@robt](https://discourse.nodered.org/u/robt)
#### Post date: [23 September 2026 12:58 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823/1 "2026-09-23T12:58:43Z")

</div>

I have two questions regarding tcp request node, please.

1. How can I detect if a tcp connection is established or not in dashboard? I connect and disconnect manually. Additionally , I can send commands to the server via dashboard buttons. I would would like to prevent sending commands if the client is disconnected.  
Also I would like to indicate connection status with green or red button.

2. It seems that a inject node that injects something single time after a second, does not  
work as expected if dashboard has been started. It works in editor, manually injected.  
The intention is to setup dashboard switches to off, for the case they are on and to disconnect tcp during dashboard start in any case.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [23 September 2026 13:37 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823/2 "2026-09-23T13:37:52Z")

</div>

What do you mean by 'dashboard'? Do you mean node-red-dashboard, @flowfuse/node-red-dashboard, or are you talking about the node-red editor?

Also when you say you want to detect if the connection is established in dashboard, do you actually mean in a node-red flow?

> [@robt](#):
>
> 1. I would would like to prevent sending commands if the client is disconnected.

Which client are you talking about?

---

<div class="post-metadata">

### Author: ![robt](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@robt](https://discourse.nodered.org/u/robt)
#### Post date: [23 September 2026 13:50 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823/3 "2026-09-23T13:50:22Z")

</div>

I mean the node-red dashboard, of cause.

This is the client I currently mean:

 ![Screenshot 2026-09-23 154816](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/0/808791f1f21a8f111e4f9d551956aae1b87202c7.png)

---

<div class="post-metadata">

### Author: ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)
#### Post date: [23 September 2026 13:56 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823/4 "2026-09-23T13:56:23Z")

</div>

> [@robt](#):
>
> 1. How can I detect if a tcp connection is established

You could attach the status node to the tcp node to obtain changes in connection status but that feels a little like a hack

```flows
[{"id":"8711b5c3da75af56","type":"tcp request","z":"99338e433530145b","name":"","server":"","port":"","out":"time","ret":"buffer","splitc":"0","newline":"","trim":false,"tls":"","x":1341.655517578125,"y":480.84393310546875,"wires":[[]]},{"id":"1b71b2eb07490f38","type":"status","z":"99338e433530145b","name":"","scope":["8711b5c3da75af56"],"x":1292.811149597168,"y":566.5888996124268,"wires":[["50d6656fb21967f9"]]},{"id":"50d6656fb21967f9","type":"debug","z":"99338e433530145b","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1489.519775390625,"y":569.951416015625,"wires":[]}]

```

the output of the status node would then be sent to the dashboard.

> [@robt](#):
>
> 1. It seems that a inject node that injects something single time after a second

Use the cron-plus node for all things to do with regular job triggering. inject node will only inject once the flow is restart.

Generally you have to update the dashboard manually meaning you send the corresponding dashboard nodes messages via the flows you design in the editor.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [23 September 2026 14:06 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823/5 "2026-09-23T14:06:22Z")

</div>

> [@robt](#):
>
> I mean the node-red dashboard, of cause.

To be pedantic the ui-switch that you show is from @flowfuse/node-red-dashboard, not node-red-dashboard.

> [@robt](#):
>
> This is the client I currently mean:

There are multiple clients there, the browser running the node-red editor, the client running the dashboard, showing the switch, and node-red itself which is a client of the tcp connection. I am guessing that you mean when there is no browser open looking at the dashboard. Is that correct? If so then that is not easy.

---

<div class="post-metadata">

### Author: ![robt](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@robt](https://discourse.nodered.org/u/robt)
#### Post date: [23 September 2026 14:19 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823/6 "2026-09-23T14:19:18Z")

</div>

I'm sorry if I not precise enough. But I'm still beginner and I do not look behind the  
capabilities and the terminology yet.

I mean , if I run the flow either starting from node-red-editor or directly via the link (without editor).

It could be that either the flow in dashboard is terminated without disconnect or the server is suddenly not available anymore or the server is not running. During the next new start of the flow there is no synchronization between the client in dashboard and the server. That is what I would like to prevent.  
Hopefully you understand what I mean.

Thanks for help.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [23 September 2026 14:44 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823/7 "2026-09-23T14:44:39Z")

</div>

> [@robt](#):
>
> Hopefully you understand what I mean

Not fully. Do you mean that when node red is started the switch in the dashboard may not show the correct connected state?

Is so then use a Status node as suggested earlier and use that to set the switch position.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [23 September 2026 15:26 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823/8 "2026-09-23T15:26:51Z")

</div>

> [@robt](#):
>
> 1. It seems that a inject node that injects something single time after a second, does not  
> work as expected if dashboard has been started. It works in editor, manually injected.

On this question, I don't understand what you mean by 'if dashboard has been started'. The flow image that you posted should certainly set the switch to Off when node-red is restarted, which is when the inject will fire.

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [23 September 2026 16:06 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823/9 "2026-09-23T16:06:53Z")

</div>

> [@robt](#):
>
> 1. How can I detect if a tcp connection is established or not in dashboard? I connect and disconnect manually.

Can you explain how you, as a user of the system, not via the editor, connect and disconnect TCP?

> [@Colin](#):
>
> There are multiple clients there, the browser running the node-red editor, the client running the dashboard, showing the switch, and node-red itself which is a client of the tcp connection.

Node-red runs on a computer of some sort. You can access the editor and/or the dashboard via a browser, which need not be on the same computer.

Please give us a bit of info on your setup.

What is at the far end of the TCP connection? Are you turning something on and off?

---

<div class="post-metadata">

### Author: ![robt](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@robt](https://discourse.nodered.org/u/robt)
#### Post date: [23 September 2026 16:36 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823/10 "2026-09-23T16:36:29Z")

</div>

First , thank you both for trying to help.

I think it'll be the best to provide a simple example how I use the tcp request node.  
However , I currently run out of time and I can only provide this example end of next week.

In advance, my project is to receive data from an external weather station which  
deliver a set of information any second. I manually connect and disconnect to the server. To be able to control the server in the weather station , I can simultaneously send different commands. For example to select different sets of information or select the raw data of the different sensors.

I'm going to provide just the tcp part of that project, so you can see what I'm doing  
at the input side of the tcp request node.  
Again, I'm a newcomer with node-red and I possible do something more complicated as experts would do.

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [23 September 2026 16:51 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823/11 "2026-09-23T16:51:20Z")

</div>

It might help us to advise if you can share the make and model of the weather station, or if it is a public station with a website, the URL.

---

<div class="post-metadata">

### Author: ![robt](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@robt](https://discourse.nodered.org/u/robt)
#### Post date: [23 September 2026 17:06 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823/12 "2026-09-23T17:06:03Z")

</div>

The weather station is a commercial unit without web capability, it just delivers a data stream of results of the different sensors. I already designed a simple server using PlatformIO for a ESP8266 device. The ESP receives the data from the sensor unit and translates it to visible values. The server also handles the tcp connection and the selection of the different data formats. Nothing special.

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [23 September 2026 17:12 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823/13 "2026-09-23T17:12:58Z")

</div>

I and many others use MQTT to exchange data between ESPs and Node-red.  
Not saying that's better than your TCP arrangement, it's just the protocol I prefer.

---

<div class="post-metadata">

### Author: ![robt](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@robt](https://discourse.nodered.org/u/robt)
#### Post date: [23 September 2026 17:41 UTC](https://discourse.nodered.org/t/question-about-tcp-connection-status-and-inject-node-during-dashboard-start/101823/14 "2026-09-23T17:41:58Z")

</div>

Yes, could be better. However, I did some other projects with tcp arrangement before  
and I'm quite familiar with it. So I currently prefer this solution.

Tanks for your friendly support.  
I have to leave.
