-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Implement Compression Extensions #3
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
Comments
Is there anyone working on this? |
@cenkalti, not yet, but soon. |
Has there been any progress on this? |
There has not been progress on this. |
Ok, I will probably have something ready for a first review early next week. |
@fancycode Please give an overview of your design before doing a large amount of work. |
Sure, I will write a couple of notes later today or tomorrow. For now progress is pretty much stuck with some missing functionality in "compress/flate" (https://code.google.com/p/go/issues/detail?id=7836) which prevents supporting compression for fragmented packages... |
https://code.google.com/p/go/issues/detail?id=7836 is marked as fixed now, any chance for update on this? |
I do not plan to implement this feature. |
Is this implementation in progress? If so where can I follow? |
@euforia The implementation is not in progress. |
👍 We'd love to see this implemented and posted a $100 bounty on Bountysource. |
I'll try to put it on my docket. Will keep you guys posted. |
Guys, I have some progress on this. I'm developing Go-based game server, which uses websocket protocol (gorilla implementation). For sure I need compression support for my messages, so I implemented support for compression extension, but with some reservations:
For the last two options I don't think it is a problem as these features are optional for protocol extension. Please let me know if you are interested and I'll prepare fork, PR or something else. |
That is great news. I am definitely interested. I can probably add more given there's a starting point. Would you mind pointing me to the repo? |
@euforia I'm about to extract the code from our server and prepare a PR |
Awesome. I'll keep an eye out. Much appreciated. |
@euforia @garyburd This is the commit: allaud@23f691f I understand it is a bit rude, but I suggest to start discussion from this point. |
@allaud: This is perfect though I think |
@euforia LZMA and Deflate libs both have same interfaces, so it should be easy to replace lzma algorithm with deflate. So I don't think it is a good idea to use |
@allaud: |
@euforia good idea, will try to find some time to implement |
@allaud: seems like the test cases are failing when trying to write a control frame. |
@allaud - Thanx for the initial boiler plate code. The current code has provisions to add arbitrary compression. I have a working server implementation with
The implementation most definitely has room for improvement and optimization (compression, buffers etc.). @garyburd - Would you mind taking a look to verify it meets the design needs? The compression / decompression code is in the |
|
@garyburd: Here's the updated code as requested - euforia@4c4c22e It passes all autobahn tests and contains code per your guidelines. There are a couple of points to consider:
If everything checks out I can submit a PR. Let me know. |
Here are some quick comments. I'll look at the code in detail later. The Upgrader and Client types should have fields specific to this extension and use them in the negotiation. As it stands now, a client application can specify extensions not supported by the package. All compression code should be written specifically for permessage-deflate.
Selective compression is part of the protocol. The reader should support it. |
@garyburd: Updated as requested - euforia@b99472f |
@garyburd - Any thoughts or should I just do a pull PR? |
The Upgrader and Client types should have fields specific to this extension and use them in the negotiation. As it stands now, an application can specify extensions not supported by the package. Use boolean variable to indicate that compression was negotiated instead of a string length. Do not compress control messages written with NextWriter. Can the read code be simplified to the following?
Write an io.Writer adaptor between the flat writer and underlying message writer to capture the last bytes written. There's no need to allocate a []byte and copy to it on every write. Skip the optimizations in WriteMessage when compression is enabled:
The compression writer does not need to know about the final frame flag. The compression writer should not implement ReadFrom. There's no optimization to be had. |
@euforia What's the status for the PR? Do you need help? |
Sorry haven't had a chance to work on this. This is what I have so far - https://github.com/euforia/websocket/tree/compress |
@brandoncole I am waiting on requested changes. |
@garyburd - I've updated the code as requested. Can you please take a look before I do some cleanup and submit an official PR? Particularly the optimization in WriteMessage. Let me know. https://github.com/euforia/websocket/tree/compress2 |
Hi @euforia I tried your compress2 branch, edited the chat example to use your version and changed the upgrader... Works perfectly.... Until the first ping (MessageType 9) goes through...
This patch fixes the panic, and doesn't seem to break anything else the client seems to be pinging just fine
Ignore my patch... 09, Should be compressed but isn't... at which point the client (chrome) disconnects |
@euforia It's looking good, but there are some minor issues remaining. Can you submit a PR with your squashed changes and I'll take it from there? |
Will do. Thanks. |
@garyburd any updates on this? Let us know if we can help out in any way! :) |
I added code to support the feature in a87eae1. The CL description lists the remaining work. Interested parties should let me know if they want to take on any of that work. |
FYI I am interested in seeing this work completed and I have started to come up to speed with the internals of this library. If someone is already looking into this, or has further suggestions beyond the comments in a87eae1 please let me know. |
I updated the issue with a check list of work to do. Work on the Conn type should be complete. When compression is negotiated, set the The functions The |
I'd like to solicit early feedback on the following approach: Only support server+client no context takeover at first. This limits the scope of my initial changes, and is a relatively simple change compared to full negotiation support. The following new fields/methods would be exported from the package if this approach is taken:
|
Yes. The first step is to add the negotiation required to use the existing no context takeover compression wrapper functions.
The exported fields/methods look good. In the long term, there should be a Conn method to that returns the negotiated compression options. I suggest holding off on that until it's worked out how to specify negotiation options in the Dialer and Upgrader. |
Closed by c09b72d. |
Draft RFC: http://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-17
Work remaining:
Add fields to Dialer for specifying compression options.
Add fields to Upgrader for specifying compression options.
Add compression negotiation Upgrader.
Add compression negotiation to Dialer.
Add function to enable/disable write compression:
The text was updated successfully, but these errors were encountered: