Add support for permessage-deflate
when sending or receiving messages.
#43
+88
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to add support for message compression via the
permessage-deflate
extension. Message compression is disabled by default, and can be configured via the following functions:Do note that enabling message compression on the websocket client will not necessarily mean it will be enabled, as it is negotiated with the websocket server during handshake (and the server must allow it).
I modified the README as well to document the new functions and add a warning about CRIME/BREACH attacks which occur when compressing responses in a secure connection (HTTPS/WSS). The library in its current state does not enable us to disable compression on a per-message basis, so it's up to the end user to be smart with what they do (which is why it's disabled by default).