Is WebSocket compatible with HTTP/3
Asked Answered
T

2

32

The upcoming HTTP/3 standard is no longer based on TCP, but on the QUIC protocol. WebSocket is based on TCP and is initiated as HTTP update.

Is a WebSocket connection initiated as HTTP/3 update based on QUIC instead of TCP? Or is it not possible to update a HTTP/3 connection to a WebSocket connection?

Trever answered 6/8, 2019 at 14:20 Comment(2)
The current WebSocket protocol requires TCP, though there is nothing stopping implementations from including support for QUIC at the transport layer. There are proposals to adapt the WebSocket protocol to QUIC/HTTP3, though.Tedium
I think a new approach is taking over: a replacement for WebSockets and WebRTC that supports both Reliable streams and Unreliable datagrams optionally via quic: wicg.github.io/web-transport For now I think you're best off using SSE (EventSource) for QUIC based server sent eventsIntuitionism
S
23

UPDATE: 2023: as of the writing of this post there is a relatively new specification RFC9220 for websockets built on top of HTTP3 https://datatracker.ietf.org/doc/rfc9220/ .

  • Please note RFC 9220 is a specification and so does not help answer questions like: does web-browser X/Y/Z (or library A/B/C, or operating system D/E/F) support this?

Since this is the top search result for "http3 websockets", I want to keep the answers up-to-date.

As of December 2021, there is now an IETF draft that amends RFC8441 (Bootstrapping WebSockets with HTTP/2) with the adjustments necessary for HTTP/3. If the draft is accepted, there will be a standardized way for WebSockets to be initiated over HTTP/3.

The draft is on its second revision and will expire in July 2022 if there are no further revisions and it is not accepted by that time.

Synge answered 19/4, 2022 at 14:47 Comment(1)
Now moving to RFC9220Fibrovascular
S
9

Currently only HTTP/1.1 is supported by the RFC6455 to be used for connection upgrade.

Once a connection to the server has been established (including a
connection via a proxy or over a TLS-encrypted tunnel), the client
MUST send an opening handshake to the server. The handshake consists of an HTTP Upgrade request, along with a list of required and
optional header fields. The requirements for this handshake are as
follows.

  1. The handshake MUST be a valid HTTP request as specified by [RFC2616].

  2. The method of the request MUST be GET, and the HTTP version MUST be at least 1.1.

However, there are proposals to support HTTP/2 as well as HTTP/3 (as Remy Lebeau mentioned in comment above).

Shayna answered 10/1, 2021 at 16:9 Comment(2)
For HTTP/2 this answer is slightly outdated, see: tools.ietf.org/html/rfc8441Tumefy
I don't get this answer. Point 2 clearly states "at least 1.1". There's no reason for Websockets not to work over Http3.Noonan

© 2022 - 2024 — McMap. All rights reserved.