fanout / django-eventstream

Server-Sent Events for Django
MIT License
650 stars 85 forks source link

EventsConsumer doesn't work with channels >=2.1.6 #31

Closed vfernandezmartinez closed 5 years ago

vfernandezmartinez commented 5 years ago

When using Django Channels >= 2.1.6, EventsConsumer doesn't work. Upon sending a GET request to the SSE endpoint (e.g. with curl), no response data is received back and the connection is left open. EventsConsumer never replies and no events are delivered. This didn't happen with channels 2.1.5, where it works fine.

The implementation of AsyncHttpConsumer was changed in 2.1.6, which seems to be the cause of this issue. As a result, EventsConsumer.disconnect() gets called and the consumer is left in this dangling state. A dirty workaround is to await the self.stream task at the end of EventsConsumer.handle().

jkarneges commented 5 years ago

Indeed (https://github.com/django/channels/issues/1249). I'll look at implementing a workaround soon, or pin the dependency to 2.1.5.

jkarneges commented 5 years ago

Released new version with workaround.