5 releases (breaking)
0.9.0 | Mar 31, 2024 |
---|---|
0.8.0 | Mar 22, 2024 |
0.5.0 | Aug 10, 2023 |
0.3.0 | Jul 19, 2023 |
0.2.0 | Jul 17, 2023 |
#11 in #client-server-communication
65 downloads per month
Used in 2 crates
8KB
113 lines
WebTransport
WebTransport is a new web API that allows for low-level, bidirectional communication between a client and a server. It's available in the browser as an alternative to HTTP and WebSockets.
WebTransport is layered on top of HTTP/3 which is then layered on top of QUIC. This library hides that detail and tries to expose only the QUIC API, delegating as much as possible to the underlying QUIC implementation.
QUIC provides two primary APIs:
Streams
QUIC streams are ordered, reliable, flow-controlled, and optionally bidirectional. Both endpoints can create and close streams (including an error code) with no overhead. You can think of them as TCP connections, but shared over a single QUIC connection.
Datagrams
QUIC datagrams are unordered, unreliable, and not flow-controlled. Both endpoints can send datagrams below the MTU size (~1.2kb minimum) and they might arrive out of order or not at all. They are basically UDP packets, except they are encrypted and congestion controlled.
Crates
This project is broken up into a few different crates:
- web-transport-quinn mirrors the Quinn API, abstracting away the HTTP/3 setup.
- web-transport-wasm wraps the browser API
- web-transport-proto a bare minimum implementation of HTTP/3 just to establish the WebTransport session.
- web-transport provides a generic interface, delegating to web-transport-quinn or web-transport-wasm depending on the platform.
Dependencies
~215KB