Is there a way to determine how many websocket clients are connected at any point in time?
I have a timer based routine that computes a Javascript structure to be sent to connected clients via JSCRIPT command. But it is not necessary if nobody is connected, so I'd prefer to RETURN from the timer routine early in such cases. I thought I might do this by just incrementing a "connected" client variable inside the onHTMLRELOAD event, but I have no way of knowing when a websocket disconnects to decrement such a variable.
Since Annex must maintain a list of sockets somewhere internally, I was hoping there was perhaps an undocumented feature that could tell me how many such sockets exist?
Determine # of Websocket clients?
- cicciocb
- Site Admin
- Posts: 2383
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 498 times
- Been thanked: 1675 times
- Contact:
Re: Determine # of Websocket clients?
No, it is not possible to know how many websocket connections are active.
However, if there are no clients connected, the commands HTML, CSS, JSCRIPT ..... are simply ignored.
However, if there are no clients connected, the commands HTML, CSS, JSCRIPT ..... are simply ignored.