Hi Suresh, Yes, celery task can send websocket message to client/JS. My celery task uses websockets Python module to contact a Daphne channel belongs to JS client.
On Mon, Mar 18, 2019 at 8:28 PM Manas Nikam <[email protected]> wrote: > You can use firebase cloud messaging > > On Mon, Mar 18, 2019, 5:50 PM Suresh Jeevanandam <[email protected]> > wrote: > >> In my web application based on Django and Channels, the user makes a >> web-socket and send a JSON message. This initiates a celery task and a >> reference to the task is sent to the user. Now, I want to update the client >> when the results are ready. >> >> The possible solutions I thought were: >> 1. The client sends a message through the same WebSocket asking for an >> update on the particular task with its ID. The server will reply not-ready >> and will send the result once ready. >> 2. Use https://github.com/fanout/django-eventstream and make a stream in >> a view (/task/ID/update/). This might result in wasting the server-side >> resources (because of continuous polling in the view). >> >> Is there any other better way. >> >> Is there any background task that we can initiate in the consumer and it >> will initiate communitation (send message) when needed. Or better yet, is >> there a way we can write to the client's web-socket from the celery task. >> >> - >> Suresh >> >> -- >> 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 [email protected]. >> To post to this group, send email to [email protected]. >> 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/d6ee181c-8d02-4a51-9215-3da10a75773c%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/d6ee181c-8d02-4a51-9215-3da10a75773c%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> 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 [email protected]. > To post to this group, send email to [email protected]. > 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/CAF%2BYYc5HdBqT5z9ku_PJ-u3Ac6uXBf%2BpTaTxWox1up_rMw%2BVxQ%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAF%2BYYc5HdBqT5z9ku_PJ-u3Ac6uXBf%2BpTaTxWox1up_rMw%2BVxQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > 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 [email protected]. To post to this group, send email to [email protected]. 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/CAN7EoAaWMRZ0jb530A1qq763vu%2B2fOf4hKR4MVf%3DQ3XusFUFtg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

