In the consumer example that Django Channels provides (attached image) about implementing an HTTP endpoint for Server-sent events (SSE), it leaves me with a doubt: If I implement an endpoint with that consumer, connect to it from a client, and then disconnect, it throws the following error:
[image: ss.23-04-18.10-09-20.png] [image: ss.23-04-18.10-24-20.png] And it makes sense since the consumer stays inside the while loop perpetually making an asyncio.sleep(1), and there is no other choice but to kill the function. And if I remove the while loop, the connection closes by itself because the handle function ends. How could I solve this error? What is the correct way to keep the connection open until the client closes it and avoid that error? I am attaching the URL of the Django Channels documentation from where I extracted the image. It is located at the bottom of the page: https://channels.readthedocs.io/en/stable/topics/consumers.html -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/69c2004b-1a07-4353-87d2-49594d5842a7n%40googlegroups.com.

