27

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?

2
  • 1
    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. Aug 6, 2019 at 18:36
  • 5
    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 events Jun 28, 2020 at 16:24

2 Answers 2

19

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.

1
  • 7
    Now moving to RFC9220 Jun 20, 2022 at 14:52
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).

2
  • 5
    For HTTP/2 this answer is slightly outdated, see: tools.ietf.org/html/rfc8441
    – user1087001
    Jan 21, 2021 at 15:01
  • 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.
    – freakish
    Aug 29, 2022 at 6:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.