-
Notifications
You must be signed in to change notification settings - Fork 125
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
WebSocket: enable support for per-message compression #2029
Conversation
Codecov Report
@@ Coverage Diff @@
## 2-dev #2029 +/- ##
==========================================
- Coverage 93.77% 93.58% -0.20%
==========================================
Files 123 122 -1
Lines 7586 7589 +3
==========================================
- Hits 7114 7102 -12
- Misses 472 487 +15
Continue to review full report at Codecov.
|
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.
Welcome back uWS 🎉
Co-authored-by: Adrien Maret <amaret93@gmail.com>
@Aschen > I applied your requested changes. |
Co-authored-by: Michele Leo <bluedraggy@gmail.com>
@Leodau > changes applied. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Description
Closes #1734
This PR enables per-message compression for websocket connections.
To do this, this PR replaces the ws module with the uWebSockets.js one: the latter is faster, more stable, and not prone to the catastrophic memory fragmentation issue with Node.js (mitigated in later Node.js 12.x versions).
Since µwebsockets uses C sockets, we cannot replace the WebSocket layer without replacing the HTTP one too: we cannot reuse the Node.js HTTP socket for WebSocket, and we don't want Kuzzle to have 2 different network ports for HTTP and WebSocket.
So this PR also lets µws handle HTTP connections, hence the sizeable refactor.
Enhancements
allow-encoding
HTTP header is now properly interpreted: before this PR, the priority argument<algorithm>;q=<priority>
was ignoredbusboy
dependencyheartbeat
option is now deprecated and ignoredidleTimeout
now cannot be deactivated, and its value cannot be set lower than 1000ms. To prevent breaking changes with existing installs, this option is defaulted to 60000ms if set to a value lower than 1000.compression
option has been added. It takes a boolean (false
by default): setting this option totrue
enables per-message compressionOther changes
kuzzle:network:*
(fromkuzzle:entry-point:*
)server:getConfig
removed the entirehttp
configuration from its output, instead of just the HTTP routes one (http.routes
). This has been fixed, as not returning the http config is a bit confusing (I know I was perplexed when trying to figure why I didn't have HTTP config in that route output)Bug fixes