# Uibuilder: How to send data when a client connects or reloads the page

**URL:** <https://discourse.nodered.org/t/uibuilder-how-to-send-data-when-a-client-connects-or-reloads-the-page/3756>\
**Category:** Share Your Projects\
**Created:** [7 October 2018 12:36 UTC](https://discourse.nodered.org/t/uibuilder-how-to-send-data-when-a-client-connects-or-reloads-the-page/3756 "2018-10-07T12:36:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [7 October 2018 12:36 UTC](https://discourse.nodered.org/t/uibuilder-how-to-send-data-when-a-client-connects-or-reloads-the-page/3756/1 "2018-10-07T12:36:43Z")

</div>

Please note the new page in the [uibuilder WIKI](https://github.com/TotallyInformation/node-red-contrib-uibuilder/wiki/) that explains how to immediately send data to new clients connecting to the page.

This is great with the new file-based global variables in Node-RED as it is very easy to save the data that you want to have sent to a new client when they connect (or when they reload the page in the browser).

 ![trigger flow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/fbb95387b8d4a9e0cc763d002b4c4c0d6ed7085e.png)

The WIKI entry has an example flow and explains the issue and the resolution.

Combine this with the entry on [caching](https://github.com/TotallyInformation/node-red-contrib-uibuilder/wiki/Message-Caching) and [cache replay](https://github.com/TotallyInformation/node-red-contrib-uibuilder/wiki/Cache-and-Replay-Messages-without-using-node-red-contrib-infocache) as they are related. However, using the new global variable features for retaining variables so they are recovered after a restart reduces the need for caching.

> **[TotallyInformation/node-red-contrib-uibuilder](https://github.com/TotallyInformation/node-red-contrib-uibuilder/wiki/How-to-send-data-when-a-client-connects-or-reloads-the-page)**
>
> Easily create web UI's for Node-RED using any (or no) front-end library. VueJS and bootstrap-vue included but change as desired. - TotallyInformation/node-red-contrib-uibuilder

---

<div class="post-metadata">

**Author:** ![xpercad](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xpercad/32/19857_2.png) [@xpercad](https://discourse.nodered.org/u/xpercad)\
**Post date:** [28 July 2020 16:41 UTC](https://discourse.nodered.org/t/uibuilder-how-to-send-data-when-a-client-connects-or-reloads-the-page/3756/2 "2020-07-28T16:41:47Z")

</div>

> [@TotallyInformation](#):
>
> file-based global variables in Node-RED as

I have the problem that MQTT retained messages are received by MQTT IN nodes in Node-Red when a client connects or reloads the page, but this messages are not detected on Uibuilder. Any idea how to refresh MQTT retained messages on Uibuilder when a client connects or reloads?  
Many Thanks!

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [29 July 2020 08:11 UTC](https://discourse.nodered.org/t/uibuilder-how-to-send-data-when-a-client-connects-or-reloads-the-page/3756/3 "2020-07-29T08:11:12Z")

</div>

> [@xpercad](#):
>
> I have the problem that MQTT retained messages are received by MQTT IN nodes in Node-Red when a client connects or reloads the page, but this messages are not detected on Uibuilder

MQTT retained msgs are only resent in Node-RED when it restarts. In order for a uibuilder page reload or new connection to get them, you need to use a `cache`. There is an example in the library and a couple in the WIKI of how to do this.

---

<div class="post-metadata">

**Author:** ![xpercad](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xpercad/32/19857_2.png) [@xpercad](https://discourse.nodered.org/u/xpercad)\
**Post date:** [29 July 2020 16:14 UTC](https://discourse.nodered.org/t/uibuilder-how-to-send-data-when-a-client-connects-or-reloads-the-page/3756/4 "2020-07-29T16:14:12Z")

</div>

Thanks a lot for the info, cheers!
