Wednesday, February 26, 2020

Re: send django channels 2 messages to an individual user who might have more than one browser tab or device connected

Hi Andreas;

The  Channels2   system that we are using is for connecting  couriers to their working  customers.   This is planned to be a large system using Channels2, which is in pilot phase now.

When a  courier is connected to  channels we create a a database filed to keep the user_name and channel_name and when disconnected to delete.   We do the same for customers but customers might be connected from many browsers and mobile devices (more than one connection).  So we send the data ( ws message containing location) coming from couriers  to the actual customer connections in a while loop  using  "channel_layer.send"  -  one for each .

I have two questions:
1.  Is the sending method used convenient, or should i change it to create a group for customers by  user name and use group_send   to them.  Which one is better technically?  I see that sometimes channel fails (can be wifi - internet failure ) but  systems does not close and it persist as data in database so the system tries to send data to non existing channel.  Is there a mechanism to check if that channel exists  at the moment?
2. This is planned to be a large system   which will contain 3-4 thousand couriers and hundreds of customers (with more than one connections).   Which tools should we use as data load increases?   Is there a documentation for that?

We use:
channels==2.3.1
channels-redis==2.4.1
Django==2.2.4
Python 3.6.9


BR

Levent



Andréas Kühne <andreas.kuhne@hypercode.se>, 14 Şub 2020 Cum, 11:08 tarihinde şunu yazdı:
Regardless of how the user is connected - if you send a django channels message to the user - you will send it to all connected devices.

Regards,

Andréas


Den ons 12 feb. 2020 kl 20:03 skrev Levent Engin <leventenginx@gmail.com>:
Hi all.
I want to send Channels2  messages to an individual user who might have more than one browser tab or device connected.  How can I do that. In documents it is said that "group_send"  structure  can be used. how can i implement that?  Is there a sample code for this?

Best  Regards.

Levent

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANQNAiS6-CY2%3D2qDmc3Mcv7icKGLH0H4Hmm7ox0KVoc_L3HE%3DA%40mail.gmail.com.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK4qSCf9wU4LdWDsrLhOQZaA3A5%3DtTbsa7%2BvPNX1BpSDfZ1KfA%40mail.gmail.com.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CANQNAiRw82BrYhEnDQH0KPX4HzyxFaGU5TqVWAck_9L5q9t5%2Bw%40mail.gmail.com.

No comments:

Post a Comment