-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to accept websocket extensions #331
base: main
Are you sure you want to change the base?
Conversation
Also accept `permessage-deflate`, `permessage-bzip2` and `permessage-snappy` compression extensions by default if client requests for them. Compression/decompression of the messages is taken care of by `autobahn` package.
even for unchanged files, because TravisCI build fails.
Fixes #326 |
Hey @carltongibson, could you please take a look at this PR. I could update it as needed. |
Hi @albertas Thanks for this. I'm going to focus on the Channels release and then I'll cut back to do a release here! |
Hi @carltongibson, could I get an update/feedback for this PR? I see that Daphne v3 was already released. Is there any chance for releasing this PR in near future? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @albertas — sorry for the pause. Only so much bandwidth.
If you can rebase we'll look to get in. Thanks! 👍
If I'm understanding correctly, Daphne doesn't support websocket extensions as-is and this PR would add support for that? |
@benrudolph If you wanted to pick this up and rebase it, I'd be happy to have a look. |
alrighty, i'll take a look |
Well, merge conflicts were trivial: only for added imports. I have solved them using web editor in no time. |
So @benrudolph — does this allow you to do what you're after? |
thanks, yes. i realize that this just enables adding extension headers to support compression, not compression itself, but this does help. channels doesn't really provide the capability to compress out of the box, but it's certainly a no-go if daphne ignores the headers. in any case, yes, this is great, thanks! |
Ok, thanks for the feedback @benrudolph. If you want to discuss what else you'd need in a Discussion on Channels that would be good, but we'll look to get this in here in the meantime. |
Thanks appreciate it |
@benrudolph Well, Daphne uses Autobahn package underneath, which has implementation for various compressions. This PR both enables to accept any kind of headers and enables |
oh amazing! 🔥 🔥 that's a huge win |
@carltongibson anything we can do to get this puppy in? |
@benrudolph Not really. You could install it with pip, test it, report back. On schedule: We had a channel_redis release this week. Next up is Channels itself. Then I will look back to Daphne. Sorry if that's slow for you, but it's just me so it sometimes takes a while. 🙂 |
sounds good. wow! you're maintaining those 3 libraries solo?? that's simultaneously incredible and a little terrifying 👏 |
It’s mostly terrifying. 😃 (folks do help, but input welcome!) |
bump |
@carltongibson How could I help to push this one out? I will test this PR by writing simple django project example with |
Hi @albertas — Yes... — my issue is in getting to it. I'm pretty sure it's correct, but I need to review, and that involves digging into the spec and the underlying Autobahn implementation, and I just haven't got to that yet. I guess a couple of choice links here pointing me where to look would speed that up. (Silly as that sounds...) Then, do we need any additions to the README here? |
@albertas — Just to say more positively, it's been summer, but let's get a release done in September, with this in it. (By any I mean some — if I'm a user, what helps me leverage this? — Probably those links... 🤔) Thanks! |
@carltongibson here are several links I found:
|
Super, thanks @albertas — FYI I'm picking this up at the end of this week. Thanks for your input! 🎁 |
Hey @albertas — another update — I'm looking at this. Didn't make the Sept target, but Daphne is now my active thing. Thanks for your patience. |
@carltongibson Is there a way I could help? 🙂 |
Hey @albertas. Yes. Sorry. life. I haven't had any bandwidth at all for anything in the last few weeks. This issue is at the very top of my list, and will be the first I look at. (I've half looked and I think it's fine, but just need a cycle to confirm that to myself.) My next target is a release for Daphne. If you'd like to look at the other issues and PRs and think what's addressable for a release, that would be awesome. It is just me, so an extra hand in the medium term would make things more sustainable. |
@albertas Just to give some guidance on that — in case you take me up on it 😄 — I'm thinking to update the dependencies, check the Windows compatibility with the latest twisted, look at #319 properly (despite the Django auto-reloader issues) and think about dropping PY36 and PY37 (since it's not clear task cancelling is being handled properly...) — There's plenty there to begin on. |
From albertas:master
Is there any progress with this pull-request? We are enabling permessage-deflate with a strange hack by searching the WebSocketFactory in the gc.get_objects()... Having this work out of the box would really be nice |
@carltongibson Is there any chance of getting this PR forward? I could assist if needed. |
@albertas @carltongibson Any update on this pull request. it would be great to see this live. |
Yes, this is on my list for the next set of releases. |
@carltongibson you are a life saver ! |
Hi, @carltongibson, any update on this feature? seeing it live would be really nice. |
It's coming. Please don't post "any updates" type comments. Thanks. |
Sorry, clicked the wrong button. Didn't mean to close it. 🤦♀️ |
I'm a hobbyist, new to programming and git, is there anything a novice such as myself can do to help with this? I've been attempting to implement permessage-deflate in an application that utilizes channels and daphne. My understanding is that autobahn supports headers via ASGI spec 2.1 and has support for multiple message compression methods and channels now also supports headers with django/channels#2002. Therefore, WebSocket message compression with daphne/channels is dependent on this pull request. Edit: I have now tested this pull request merged with a fork of the current 'main' branch within my application which utilizes channels. I have observed via wireshark that it does indeed result in per message compression whereas before this was not possible with channels and daphne, however, it behaved in ways I did not expect with channels. In the current PR, my understanding is that daphne automatically accepts any extension that exists in autobahn PERMESSAGE_COMPRESSION_EXTENSION, the client offer and:
Now that channels accepts headers,
Now that channels supports headers, are this PR's changes to daphne/server.py needed and desirable or would it be preferable to simplify the PR to only add support for headers in daphne/ws_protocol.py and place the responsibility solely on the upstream application (channels) for determining what if any handshake response headers are to be specified? I am happy to try to help push this forward, but as you likely can tell from my writing and the fact that this is my first GitHub comment, I am far out of my depth here. Thanks. |
Also accept
permessage-deflate
,permessage-bzip2
andpermessage-snappy
compression extensions by default if client requests for them.
Compression/decompression of the messages is taken care of by
autobahn
package.