You also asked this as a GitHub issue with more detail (https://github.com/django/channels/issues/728) - I'm going to close that and answer it here, since this is the right place.
I don't have a good example for this, but I will outline how I would roughly do it (which your code already sort of does):
- Make a group per process you want to run
- Add any socket that wishes to see the status of this process to that group (your code will have to work out who an incoming socket is and assign appropriately)
- Send information to the group from whatever other Python process is monitoring the background process (note: you cannot run the process from inside a consumer, consumers should be nonblocking), for both updates and when it exits
Andrew
On Mon, Aug 28, 2017 at 3:53 AM, Samuel Muiruri <muiruri.samuel@gmail.com> wrote:
--Hi,I want to use django-channels to show progress report of a background process (percentage & time remaining) this is returned as a string.My desired process flow would be:
- User connects with sockets
- process is started
- continous feedback is sent back to specific user every "x" seconds
- final feedback with result sent and closes connection
I've gotten through setting up channels and the starting tutorial, if you can give me an example on this will be appreciated.--Best Regards,Samuel Muiruri.Web Designer
| +254 738 940064
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/ .CAJZFZXptZ4HKZOjrS_ K2zDp0xoPJRXuSpFdzBvC41hQdU9% 3DS0g%40mail.gmail.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/CAFwN1uq4czd0QnoCvSqXDixJhPdUJveipM1%3D1rb%3DqxtKWct19A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment