# Refresh text values only when using Dashboard

**URL:** <https://discourse.nodered.org/t/refresh-text-values-only-when-using-dashboard/24748>\
**Category:** Dashboard\
**Created:** [13 April 2020 12:06 UTC](https://discourse.nodered.org/t/refresh-text-values-only-when-using-dashboard/24748 "2020-04-13T12:06:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![brammh](https://avatars.discourse-cdn.com/v4/letter/b/8edcca/32.png) [@brammh](https://discourse.nodered.org/u/brammh)\
**Post date:** [13 April 2020 12:06 UTC](https://discourse.nodered.org/t/refresh-text-values-only-when-using-dashboard/24748/1 "2020-04-13T12:06:16Z")

</div>

Hi,  
I'm updating multiple (text) values in my Node-Red dashboard, which I GET from a local web-server. I update this by simply polling every 2 seconds and update the new value into my ui\_text node (it's very dynamic data).  
However if I'm not using the Node-Red dashboard, the data is still retrieved from my local server. Causing unnecessary network traffic.  
Can I for-instance only retreive data if the dashboard is active? I know it's more a design question.  
Any best practice that anyone can share?  
Thanks a ton!  
bram

---

<div class="post-metadata">

**Author:** ![Christian-Me](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian-me/32/10774_2.png) [@Christian-Me](https://discourse.nodered.org/u/Christian-Me)\
**Post date:** [13 April 2020 12:31 UTC](https://discourse.nodered.org/t/refresh-text-values-only-when-using-dashboard/24748/2 "2020-04-13T12:31:21Z")

</div>

Hi @brammh, welcome.

Take a look at the ui-control node of the dashboard. It emits a message very time a client connects or get lost with an unique socket-id. What you have to do is create a function node to keep record (i would suggest a array or object in flow or global context) creating an entry when a client logs in and deleting it if it gets lost. You even keep track if the client opens the specific tab where your text nodes are to signal your polling only if it makes sense.

Chris

---

<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:** [13 April 2020 12:50 UTC](https://discourse.nodered.org/t/refresh-text-values-only-when-using-dashboard/24748/3 "2020-04-13T12:50:53Z")

</div>

> [@brammh](#):
>
> which I GET from a local web-server.

Do you mean a web server that is under your control? If so then you could (should?) run node red in the server too and publish the data to MQTT, then the other node red can pick it up, much simplifying that flow and reducing the network bandwidth. MQTT is designed to be network efficient so publishing something every two seconds is trivial.

---

<div class="post-metadata">

**Author:** ![brammh](https://avatars.discourse-cdn.com/v4/letter/b/8edcca/32.png) [@brammh](https://discourse.nodered.org/u/brammh)\
**Post date:** [13 April 2020 14:02 UTC](https://discourse.nodered.org/t/refresh-text-values-only-when-using-dashboard/24748/4 "2020-04-13T14:02:41Z")

</div>

Thanks Gents!  
The ui-control node is helpfull, I can make it work with that.  
Will move over to MQTT. was thinking about that earlier.  
regards,  
bram

---

<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:** [27 April 2020 14:02 UTC](https://discourse.nodered.org/t/refresh-text-values-only-when-using-dashboard/24748/5 "2020-04-27T14:02:43Z")

</div>

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