Skip to content
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 over http2 #2458

Open
KhafraDev opened this issue Nov 25, 2023 · 2 comments
Open

websocket over http2 #2458

KhafraDev opened this issue Nov 25, 2023 · 2 comments
Labels
enhancement New feature or request H2 Pull requests or issues related to HTTP/2 websocket Pull requests or issues related to websocket and its standard

Comments

@KhafraDev
Copy link
Member

Refs: #2061 (comment)

@KhafraDev KhafraDev added the enhancement New feature or request label Nov 25, 2023
@metcoder95
Copy link
Member

Doing a quick check, the feature might not be that hard to add.
We basically have to tweak the first request to conform the WebSocket negotiation spec.

So far, the overall implementation should not need changes; rather just writeH2.
Fetch already provides the mode through upgrade here: https://github.com/nodejs/undici/blob/ac30400a191a78c6148c50e7ff70390a4ea93f90/lib/fetch/index.js#L1963C9-L1963C16

It is a matter of writeH2 to catch it and attach it with the correct semantics at the headers if the connection is happening through h2, and call onUpgrade if everything went well accordingly.
As fetch uses the socket directly, it should be even less complicated. But we would need to play with it to see if it works.

@baybal
Copy link

baybal commented Nov 30, 2023

FYI, here is the RFC for web socket over http 2.0 https://www.rfc-editor.org/rfc/rfc8441

@metcoder95 metcoder95 added the H2 Pull requests or issues related to HTTP/2 label Mar 8, 2024
@Uzlopak Uzlopak added the websocket Pull requests or issues related to websocket and its standard label May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request H2 Pull requests or issues related to HTTP/2 websocket Pull requests or issues related to websocket and its standard
Projects
None yet
Development

No branches or pull requests

4 participants