Web Transport Protocol: The Future of Web Communication

Web Transport Protocol: The Future of Web Communication

1.29KReads
10 June, 2023

The Web Transport Protocol is slowly but steadily becoming a reality. Chrome has released experimental support for it around a year ago, and Firefox version 114 has recently enabled support for the protocol. However, it's essential to understand that this protocol and its specification are not finalized yet. It's still in draft mode, meaning there is no official RFC number for it.

In this Miniblog post, we'll explore the Web Transport Protocol, its features, why we need another protocol and more. So let's dive in!

The Evolution of Web Communication

The Web has been built as the standard for anything that shares web pages, documents, and other content on the web. Http was created for a simple request-response mechanism, with the client always initiating the request, and the server providing the response. As we needed more interactivity from the server, developers came up with various techniques like long polling and server-sent events.

WebSockets were designed to enable bi-directional communication, upgrading the connection used for Http and using it as a raw medium for sending data back and forth. However, the WebSocket protocol has its limitations and carries some overhead.

The Http protocol has since evolved, with Http/2 and Http/3 introducing the idea of streams. This allows for concurrent requests to be sent simultaneously, using unique stream IDs.

Introducing the Web Transport Protocol

The Web Transport Protocol came in to solve a diverse set of problems and introduce more flexibility for users. Inspired by gRPC from Google, which built its own protocol on top of Http/2 and allowed for unidirectional streams and bi-directional streams, the Web Transport Protocol aims to provide similar functionality for web developers.

However, gRPC cannot be natively supported in browsers because it needs low-level access to the Http/2 API, which browsers do not offer. The Web Transport Protocol, on the other hand, allows developers to create a Web Transport session that supports bi-directional, unidirectional, or unreliable streams (similar to UDP).

Key Features of Web Transport Protocol

  • Bi-directional and unidirectional streams: Both client and server can create streams that allow for either bi-directional or unidirectional communication.
  • Unreliable delivery: Developers can create unreliable streams (called Http datagrams), which allows for out-of-order delivery and more fine-grained control for applications.
  • Http/2 and Http/3 support: Web Transport Protocol is available in two flavors, one for Http/2 and one for Http/3, offering different levels of functionality depending on the underlying protocol.

Use Cases and Benefits of Web Transport Protocol

Using the Web Transport Protocol provides developers with more control and flexibility in their applications. For example, an app developer handling out-of-order packets in a video stream can buffer and wait for the right order or skip a frame, depending on their requirements.

Furthermore, the Web Transport Protocol allows for UDP-like behavior in browsers, something that was previously only available through WebRTC. With unreliable delivery, developers can prioritize performance over the strict order of packets, which can be beneficial for specific applications, such as audio or video streaming.

Current State and Considerations

As mentioned earlier, the Web Transport Protocol is still in its draft mode, and support for it is experimental in Chrome and Firefox. Implementing Web Transport in the current ecosystem will require additional work on handling proxy support at layer 7, which is yet to be done.

Web Transport over Http/2 may have some limitations, as unreliable datagrams are not supported due to Http/2 being built on top of TCP. However, with Web Transport over Http/3, developers can utilize bi-directional, unidirectional, and unreliable delivery in their applications.

So wrapping it up, we can say, the Web Transport Protocol aims to introduce more flexibility and control for developers working on web applications, providing them with a diverse set of communication patterns to suit their needs.

While it's currently in draft mode and not yet finalized, its experimental support in browsers demonstrates its potential as a powerful tool in the future of web communication.

Subscribe for more weekly System Design, architecture, and Network related things.