--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7636117a-e2e8-4946-9f56-5128caa75709%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
But then where should I hold online users? In a database table? The documentation states using a Group is the best option because it automatically handles removing the users who have terminated their connection ungracefully (e.g, the client application has crashed and hence, it wasn't able to send a disconnect signal, which caused not running the 'websocket.disconnect' consumer, which would have handled removing this user from the online users list)
Where should I put the online users? Should I write my own boilerplate code to do what a Group does to remove inactive users from the Group, for what I will use to hold the online users?
Thanks in advance
Regards
I thought of holding online users in a table of two columns, one column is a foreign key to User table and the other column is that user's reply channel. I would run a function every minute which would check if the WebSocket connections attached to reply channels are alive for every user in this table.
However I couldn't find how I can check if a WebSocket connection of a reply channel is alive. AFAIK, there isn't a function like 'is_alive'. I could send a PING to a channel but AFAIK, the reply would arrive at the 'websocket.receive' consumer.
So, is there a way to tell if the WebSocket connected to a channel is alive or not?