Determine # of Websocket clients?

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Determine # of Websocket clients?

Re: Determine # of Websocket clients?

by SteanX » Sun Mar 10, 2024 8:41 pm

Thanks for clarifying cicciocb!

Re: Determine # of Websocket clients?

by cicciocb » Sun Mar 10, 2024 8:33 pm

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.

Determine # of Websocket clients?

by SteanX » Sun Mar 10, 2024 7:42 pm

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? :-)

Top