Feature request: ui-control to deliver array of actual connected clients

Hello,

I currently develop a flow that should show different data to different clients. I keep track on the connect and lost messages from the ui-control node but it always happen that I miss lost messages (i.e. when the flow is restarted). So I have a growing list of ghost clients in my list of clients to serve.

Would be great if the node send an array containing all currently connected sockets together with the ip-address with every connect and lost message.

msg.sockets=[{id:"one id", "ip":"one ip"},{id:"another id", "ip":"another ip"},...]

A simple array of connected ids would be sufficient for this task too.

msg.sockets=["one id","another id",...]

I haven`t looked into the code but I assume this array or object is kept somewhere.

Thank you, Chris.

As per documentation of node red dashboard:

This Dashboard does NOT support multiple individual users. It is a view of the status of the underlying Node-RED flow, which itself is single user. If the state of the flow changes then all clients will get notified of that change.

@bakman2 yeah - but each does have a session so you can "manipulate" that to some effect so for example one user can be on one tab and another on another and switching one doesn't have to switch another. They are all looking at the same data - but just from different points of view.

@Christian-Me - I'll have a poke and see what makes sense.

1 Like

Thanks a lot and
Happy Holidays!

Hmm - a quick look says we don't actually keep an array - we just report socketid as the connect and disconnect.(Doesn't mean it can't be done - just not 2 minutes effort)

Then again - on any restart we would set the array to be empty - so why can't your function do the same ? - on a restart it just starts adding new connections to an empty context variable. At a restart all client have to reconnect anyway - so at that point there will be no connections - so you can empty your ghost array.

I looked in the meantime (see edit post) too and came to the same conclusion. Think I can live with it for now, interested what happens when I send a message to an invalid socketid. If I can catch an error I can correct my own array - but I think it will be silently ignoring the invalid id.

I do that (it is stored in global.store not on the file system) so restart should start with an empty one. But after a while of testing (many deploys) invalid entries are appearing.

I have to dig deeper.

Yes - you should be able to blank your array at reset time... if not then something is up.