Well, your problem is that you have to first define "online" and "users".
If you want "the number of open WebSockets connected to the system", then you can do it using logic tied to the connect and disconnect methods, with extra logic for expiry in case you miss a disconnect (otherwise the number will continuously creep up over time). There is no simple, scalable way, however.
If you're going to have strictly less than 100 websockets connected, and you're using the Redis backend, then group_channels() would give you an approximation of that number simply, but the performance drops off dramatically as you scale up a system. It will also include connections that are up to a day old (or however long your group_expiry is)
Andrew
On Sat, Mar 25, 2017 at 9:53 AM, Volodymyr Spodaryk <volodymyr.spodaryk@gmail.com> wrote:
Hi,--is there any simple way to count online users that connected to Django Channels ?
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/d0acdec7- .26e8-4889-bd41-5afe049b035a% 40googlegroups.com
For more options, visit https://groups.google.com/d/optout .
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/CAFwN1uq1JQJpd%3DBaN1R9m1T9CtgVVf7j8tFBsLJWaTtov3r32g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment