fanout / django-eventstream

Server-Sent Events for Django
MIT License
638 stars 84 forks source link

Setup instructions with Channels 3 #59

Closed foucdeg closed 3 years ago

foucdeg commented 3 years ago

Channels 3 is out and its migration guide warns us of a few breaking changes and deprecated classes, which the setup instructions here use.

Is this lib compatible with Channels 3? Is the example code different?

jkarneges commented 3 years ago

I think some changes would need to be made to support Channels 3. Will look at this soon.

foucdeg commented 3 years ago

Great, thanks!

foucdeg commented 3 years ago

Hey @jkarneges , any updates ? :)

jkarneges commented 3 years ago

I'm considering moving to Django 3 which has built-in support for async views. Perhaps we don't need Channels anymore. I still need to plan this out though.

foucdeg commented 3 years ago

OK, I'm also using Django 3 on my app. I'd be interested in any setup instructions without Channels. No dependency is even better than an up to date dependency :)

bertrand-benoit commented 3 years ago

Hello, I'm interested too. My current attempt: Python 3.8, Django 3.1.4, Django-eventstream 3.1.0, is failing when trying to serve any page with something like:

[...]
File "/home/bsquare/.local/share/virtualenvs/lynceus_django_just_created-f6Z0-ibI/lib/python3.8/site-packages/asgiref/compatibility.py", line 33, in new_application
    instance = application(scope)
TypeError: __init__() takes 1 positional argument but 2 were given

I guess it is related to what reported @foucdeg about migration ... till then, is there any way to get a workaround now?

hadpro24 commented 3 years ago

Hello, I'm interested too. My current attempt: Python 3.8, Django 3.1.4, Django-eventstream 3.1.0, is failing when trying to serve any page with something like:

[...]
File "/home/bsquare/.local/share/virtualenvs/lynceus_django_just_created-f6Z0-ibI/lib/python3.8/site-packages/asgiref/compatibility.py", line 33, in new_application
    instance = application(scope)
TypeError: __init__() takes 1 positional argument but 2 were given

I guess it is related to what reported @foucdeg about migration ... till then, is there any way to get a workaround now?

Use channels 2.4.0 fix it

bertrand-benoit commented 3 years ago

Hello, I'm interested too. My current attempt: Python 3.8, Django 3.1.4, Django-eventstream 3.1.0, is failing when trying to serve any page with something like:

[...]
File "/home/bsquare/.local/share/virtualenvs/lynceus_django_just_created-f6Z0-ibI/lib/python3.8/site-packages/asgiref/compatibility.py", line 33, in new_application
    instance = application(scope)
TypeError: __init__() takes 1 positional argument but 2 were given

I guess it is related to what reported @foucdeg about migration ... till then, is there any way to get a workaround now?

Use channels 2.4.0 fix it

Hello, thanks for your answer ... but what are you speaking about? Atm, we use django-channels, embedded in Django 3.x version.

And I do not see any v.4.x on channels? See. https://github.com/django/channels/releases

hadpro24 commented 3 years ago

Hello, I'm interested too. My current attempt: Python 3.8, Django 3.1.4, Django-eventstream 3.1.0, is failing when trying to serve any page with something like:

[...]
File "/home/bsquare/.local/share/virtualenvs/lynceus_django_just_created-f6Z0-ibI/lib/python3.8/site-packages/asgiref/compatibility.py", line 33, in new_application
    instance = application(scope)
TypeError: __init__() takes 1 positional argument but 2 were given

I guess it is related to what reported @foucdeg about migration ... till then, is there any way to get a workaround now?

Use channels 2.4.0 fix it

Hello, thanks for your answer ... but what are you speaking about? Atm, we use django-channels, embedded in Django 3.x version.

And I do not see any v.4.x on channels? See. https://github.com/django/channels/releases

No use the : v2.4.0

bertrand-benoit commented 3 years ago

No use the : v2.4.0

So channels v2.4.0 can be used with Django 3.1.x ?

foucdeg commented 3 years ago

@bertrand-benoit yes, it works on my app. I opened this issue about Channels 3 + Django 3.

hadpro24 commented 3 years ago

No use the : v2.4.0

So channels v2.4.0 can be used with Django 3.1.x ?

Yes try it

foucdeg commented 3 years ago

Hey @jkarneges , any news on this ? :)

jkarneges commented 3 years ago

I'm planning to start looking at this before the end of the month.

jkarneges commented 3 years ago

It seems Django does not yet support async streaming responses. We'll need Channels for a bit longer then.

Will update again soon.

jkarneges commented 3 years ago

Released 4.0.0 with support for Channels 3.

foucdeg commented 3 years ago

Awesome, thanks! Since both my local and production environments use Pushpin, I was able to remove Channels altogether.