# DB2 : ui-event node - doesnt always generate events

**URL:** <https://discourse.nodered.org/t/db2-ui-event-node-doesnt-always-generate-events/88826>\
**Category:** Dashboard\
**Tags:** dashboard-2\
**Created:** [20 June 2024 20:21 UTC](https://discourse.nodered.org/t/db2-ui-event-node-doesnt-always-generate-events/88826 "2024-06-20T20:21:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SandeepA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sandeepa/32/63225_2.png) [@SandeepA](https://discourse.nodered.org/u/SandeepA)\
**Post date:** [20 June 2024 20:21 UTC](https://discourse.nodered.org/t/db2-ui-event-node-doesnt-always-generate-events/88826/1 "2024-06-20T20:21:40Z")

</div>

Hi

My dashboard is displayed to end user via. iFrame.  
Calling app sends some params as part of URL (query params)  
My params are tied up to specifc user operating the dashboard - so i need to maintain the params to socket Id connection (do it via. flow context)

I am using today ui-event to detect when the user opened the page and params sent.

Observation is - ui\_event gets triggered only once. While for every deployment or sometimes when the user has been away from the screen for a lot of time the socket connection breaks and new socket id comes in. No ui\_event gets generated for this.  
This causes a problem that now i cannot find the params connected to the user.

Is there any other smart mechanism to detect when a user came to dashboard ?  
(I was relying completely on ui\_event - but as explained above - it doesnt always generate events)

---

<div class="post-metadata">

**Author:** ![arturv2000](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/arturv2000/32/88724_2.png) [@arturv2000](https://discourse.nodered.org/u/arturv2000)\
**Post date:** [20 June 2024 22:29 UTC](https://discourse.nodered.org/t/db2-ui-event-node-doesnt-always-generate-events/88826/2 "2024-06-20T22:29:02Z")

</div>

Hi

Just tried it, and it seems that the `ui-event` will only receive the `lost` event when the WebSocket connection is disconnected from Android.

Upon resume the tab on android, (when the popup indicating that the connection was lost and it is attempting to reconnect), the `ui-control` (Configured in this case to Output All Events) is the one that receives the `connect` event with the new `socketId`, the `ui-event` seems to only trigger with page changes not with socket reconnection...

Don't know if this is suppose to operate this way, but a quick work around would be to use also the `ui-control` to check for user returning to the page.

---

<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:** [21 June 2024 07:56 UTC](https://discourse.nodered.org/t/db2-ui-event-node-doesnt-always-generate-events/88826/3 "2024-06-21T07:56:23Z")

</div>

Not intentional, but also not well thought through. It's going to be covered in this issue here I think: [Event handlers (in custom ui nodes) not receiving widget notifications after socket reconnect · Issue #913 · FlowFuse/node-red-dashboard · GitHub](https://github.com/FlowFuse/node-red-dashboard/issues/913)

---

<div class="post-metadata">

**Author:** ![SandeepA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sandeepa/32/63225_2.png) [@SandeepA](https://discourse.nodered.org/u/SandeepA)\
**Post date:** [21 June 2024 10:02 UTC](https://discourse.nodered.org/t/db2-ui-event-node-doesnt-always-generate-events/88826/4 "2024-06-21T10:02:22Z")

</div>

This is what i did as well. I use the template node as i need to capture the URL params. WA exists but it means implementing some more nodes - when can be avoided.

---

<div class="post-metadata">

**Author:** ![SandeepA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sandeepa/32/63225_2.png) [@SandeepA](https://discourse.nodered.org/u/SandeepA)\
**Post date:** [21 June 2024 10:02 UTC](https://discourse.nodered.org/t/db2-ui-event-node-doesnt-always-generate-events/88826/5 "2024-06-21T10:02:31Z")

</div>

Thanks @joepavitt

---

<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:** [21 July 2024 10:02 UTC](https://discourse.nodered.org/t/db2-ui-event-node-doesnt-always-generate-events/88826/6 "2024-07-21T10:02:59Z")

</div>

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