# Messages to dashboard nodes when there are no connected clients

**URL:** <https://discourse.nodered.org/t/messages-to-dashboard-nodes-when-there-are-no-connected-clients/93556>\
**Category:** Developing Nodes\
**Tags:** dashboard-2\
**Created:** [28 November 2024 23:19 UTC](https://discourse.nodered.org/t/messages-to-dashboard-nodes-when-there-are-no-connected-clients/93556 "2024-11-28T23:19:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![omrid](https://avatars.discourse-cdn.com/v4/letter/o/77aa72/32.png) [@omrid](https://discourse.nodered.org/u/omrid)\
**Post date:** [28 November 2024 23:19 UTC](https://discourse.nodered.org/t/messages-to-dashboard-nodes-when-there-are-no-connected-clients/93556/1 "2024-11-28T23:19:04Z")

</div>

When a flow sends a message to a dashboard node, the node (on the server side) broadcasts the message to the node's widgets on all connected clients.  
If there ae no connected clients, then unless the node saves the message in some datastore (and replays it whenever a client connects), the message will be lost.

There have been many discussions on the pros/cons of saving & replaying message trails, and it's not always practical.

I want to address this from a different angle: is there a way for a server node to tell if it has any connected clients?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [28 November 2024 23:48 UTC](https://discourse.nodered.org/t/messages-to-dashboard-nodes-when-there-are-no-connected-clients/93556/2 "2024-11-28T23:48:48Z")

</div>

> [@omrid](#):
>
> address this from a different angle: is there a way for a server node to tell if it has any connected clients?

Kinda using ui-control you could watch and record connections disconnections. However, a means of queiring this info would be useful I think.

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [29 November 2024 09:42 UTC](https://discourse.nodered.org/t/messages-to-dashboard-nodes-when-there-are-no-connected-clients/93556/3 "2024-11-29T09:42:25Z")

</div>

If you're referring to access to this information within your third-party node, we have the information stored on the `ui-base` element.

On that, there is an object `base.uiShared` which then has `.connections`.

---

<div class="post-metadata">

**Author:** ![omrid](https://avatars.discourse-cdn.com/v4/letter/o/77aa72/32.png) [@omrid](https://discourse.nodered.org/u/omrid)\
**Post date:** [29 November 2024 10:02 UTC](https://discourse.nodered.org/t/messages-to-dashboard-nodes-when-there-are-no-connected-clients/93556/4 "2024-11-29T10:02:02Z")

</div>

> [@joepavitt](#):
>
> On that, there is an object `base.uiShared` which then has `.connections`.

Thanks Joe, I remember investigating this object in the past. But how can I tell if at least one of the connected clients includes my node?

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [29 November 2024 11:32 UTC](https://discourse.nodered.org/t/messages-to-dashboard-nodes-when-there-are-no-connected-clients/93556/5 "2024-11-29T11:32:55Z")

</div>

> [@omrid](#):
>
> But how can I tell if at least one of the connected clients includes my node?

Are you thinking about the situation whereby some users would be connected, but viewing a page that didn't have the tabulator node on it? I'm not sure that'd be possible, as we don't track which sockets are on which page, nor have we had a need to.

---

<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:** [28 January 2025 11:33 UTC](https://discourse.nodered.org/t/messages-to-dashboard-nodes-when-there-are-no-connected-clients/93556/6 "2025-01-28T11:33:14Z")

</div>

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