-
-
Notifications
You must be signed in to change notification settings - Fork 676
feat(#2458): WebSocket through HTTP/2 #4540
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
Conversation
|
I started looking into it too... perfect timing |
test/websocket/opening-handshake.js
Outdated
| }) | ||
| }) | ||
|
|
||
| // TODO: ws does not supports HTTP2; will need to potentially write a custom server for this |
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.
See websockets/ws#1458 (comment) for a simple/limited wrapper.
|
I found a bit of a wall here; for Happy to hear your thoughts @KhafraDev |
|
We check for the header because it's needed to complete the http upgrade and opening handshake (RFC 6455). For http2, we should follow RFC 8441. |
Co-authored-by: Khafra <[email protected]>
Co-authored-by: Khafra <[email protected]>
|
@KhafraDev feel free to take another look |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4540 +/- ##
==========================================
- Coverage 92.86% 92.84% -0.02%
==========================================
Files 106 106
Lines 33111 33272 +161
==========================================
+ Hits 30749 30892 +143
- Misses 2362 2380 +18 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@KhafraDev feel free to have another look to the docs and let me know your thoughts 👍 |
KhafraDev
left a comment
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.
There seems to be a relevant test failure in test/http2-dispatcher.js
docs/docs/api/WebSocket.md
Outdated
| > 🗒️ Note: WebSocket over HTTP/2 is possible to be enabled by default in further major versions, | ||
| > this will happen by enabling HTTP/2 connections as the de`fault behavior of Undici's Agent as well the global dispatcher. | ||
| > Stay tuned to the changelog for more information. |
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.
| > 🗒️ Note: WebSocket over HTTP/2 is possible to be enabled by default in further major versions, | |
| > this will happen by enabling HTTP/2 connections as the de`fault behavior of Undici's Agent as well the global dispatcher. | |
| > Stay tuned to the changelog for more information. | |
| > 🗒️ Note: WebSocket over HTTP/2 may be enabled by default in a future version, | |
| > this will happen by enabling HTTP/2 connections as the default behavior of Undici's Agent as well the global dispatcher. | |
| > Stay tuned to the changelog for more information. |
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.
Is the idea to enable http/2 by default outside of websocket? I was thinking of having it enabled only for websockets because I remember there was some push back last time you tried enabling it by default.
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.
Not really sure what could be the plan here; the thing with enabling it only for WebSocket is that it might require to use a custom agent if H2 not enabled through global dispatcher as default.
It will be better to sync them, but if we are ok deviating one from the other, that should be totally fine
Co-authored-by: Khafra <[email protected]>
|
@KhafraDev can you check? Let me know if is ok to merge it in this way |
|
There are some http2 test failures, I'm not sure if they're relevant. |
|
Seems that they are now fixed, the failures doesn't seem related to the PR's changes |
This relates to...
Closes #2458
Rationale
Implements WebSocket over HTTP/2
Note
Experimental warning is emitted on first usage.
Changes
Features
Bug Fixes
Breaking Changes and Deprecations
Status