On Mon, Jan 2, 2017 at 11:57 PM, Utku Gültopu <ugultopu@gmail.com> wrote:
Then since I will be sending different data for every user, holding online users in a single Group does not make sense right?
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?
My question to you is "why do you need a list of online users?". The answer to what storage to use varies based on what your answer to that question is.
Channels Groups are only suitable for broadcast of messages; they are not suitable for asking questions like "list all online users" or "is user X online" because of the scaling tradeoffs in there. If you want those sorts of questions, you will indeed have to manage online status yourself.
Andrew
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-users@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/CAFwN1uofYdXPVoRca0U8kdG0y73T1QJ2Dz9mwn--epBOjnc0Nw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment