django-websocket-redis icon indicating copy to clipboard operation
django-websocket-redis copied to clipboard

Seeing active connections?

Open Keilan opened this issue 9 years ago • 4 comments

Is there a way to determine if there are any active websockets? I am generating live data on the server through a fairly expensive process and I'd like to only do it when someone is listening. Alternatively, a way to check if we are receiving any response heartbeat messages would fit my needs.

P.S. Thanks for the great work on this project - I'm just getting started with websockets and this is pretty slick.

Keilan avatar May 17 '16 21:05 Keilan

This feature request has been proposed several times. Due to the lack of time, I was unable to implement it. You want to do it? It shouldn't be too difficult.

jrief avatar May 18 '16 05:05 jrief

I'll give it a shot - I'll need to get a bit more familiar with the project first. Thanks!

Keilan avatar May 18 '16 15:05 Keilan

@jrief I've made an attempt in Pull Request #192 to add this. I used a property on the WebsocketWSGIServer model, but it's not immediately clear to me how to access the property once it is set. Any pointers would be appreciated. :)

Keilan avatar May 18 '16 19:05 Keilan

A dirty hack to get them as well is to just issue the redis pubsub channels depending on how you have your sessions structured.

Fitblip avatar Aug 24 '16 20:08 Fitblip