Dashboard - Query if someone is viewing only

Hi all,
So I have some great dashboards built. However, I have a lot of inject nodes running every few seconds to query a database and display data.

My question is, is there something I can do to check if someone is actually viewing the dashboard page and if so, then run the inject queries.

Right now I am chewing up CPU and RAM by doing all there queries if someone is looking at the dashboard or not.

I am thinking a websocket...but have no idea how that works so any suggestions or examples would be fantastic.

Thanks everyone!!

look at the ui_control node. It outputs an event whenever anyone connects - so you can use that to trigger or start your queries (and then stop when =0)

The ui_control node will do what you require.

When any browser client connects or loses connection, changes tab, or expands or collapses a group this node will emit a msg containing:

  • payload - connect , lost , change , or group .
  • 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).
  • group - the name of the group. (only for 'group' event).
  • open - the state of the group. (only for 'group' event).

Optional - report only connect events - useful to use to trigger a resend of data to a new client without needing to filter out other events.

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