Reputation: 2433
How can I get node-red
to detect that the dashboard UI
page has been visited, i.e. someone is looking at the page.
I say this be cause I would then send more frequent updates to the dashboard then when no one is visiting. i know i can implement a Websockets, but then this will be a page that i create not the dashboard UI
I have looked everywhere, and in forums, no solutions offered besides create a custom webpage
Upvotes: 2
Views: 2211
Reputation: 10117
The ui_control
node can be used to emit messages when this happens.
From the info sidebar for the ui_control
node:
When any browser client connects or loses connection, or changes tab, this node will emit a
msg
containing:
payload
- connect, lost, or change.socketid
- the ID of the socket (this will change every time the browser reloads the page).socketip
- the ip address from where the connection originated.tab
- the number of the tab. (Only for 'change' event).name
- the name of the tab. (Only for 'change' event).
Upvotes: 4