# WebTransport and Kubo
WebTransport (opens new window), a new libp2p transport protocol, allows browsers to contact Kubo nodes, so instead of serving requests for other system level application nodes, you can serve requests directly to a browser. This guide will explain how WebTransport works, Kubo-WebTransport integration use cases, and how to get started with WebTransport in Kubo.
Kubo v0.16 introduced optional support for WebTransport (opens new window), and Kubo v0.18 enabled support by default (opens new window).
# How it works
Conceptually, WebTransport is similar to WebSocket (opens new window). The browser can “upgrade” an HTTP/2 (opens new window) or an HTTP/3 connection (opens new window), which runs on top of QUIC (opens new window), to a WebTransport session. A WebTransport session over HTTP/3 allows both endpoints to open very thinly wrapped QUIC streams to each other. This enables WebTransport to take advantage of QUIC's offerings:
- Speedy time to connect using a fast handshake (one network roundtrip).
- Native stream multiplexing without head-of-line blocking.
- Advanced loss recovery and congestion control.
- Low latency communication.
In a nutshell, WebTransport works with Kubo as follows:
- The browser establishes a HTTP/3 connection to the Kubo node.
- It then opens a new stream.
- An Extended CONNECT request and proposed a WebTransport Session ID are sent.
The server can accept the upgrade by sending a HTTP 200 OK response. Both endpoints can now open QUIC streams associated with this WebTransport session.
# Use cases
WebTransport in Kubo unlocks many use cases, including those listed below.
- Browser nodes or light clients can function as "full" peers in a decentralized network.
- Browser nodes can gossip directly with their peers, meaning they can receive and submit messages directly without relying on centralized infrastructure or interfaces like an HTTP/GraphQL API.
- Fetch data from the DHT by directly connecting to a DHT server node.
- Upload data directly from the browser to long-term storage such as a pinning service.
- Decentralized peer-to-peer video streaming as a dApp.
# Using WebTransport with Kubo
To get started with using WebTransport with Kubo, you can use follow this GitHub example which will teach you how to use the browser to fetch a file directly from Kubo (opens new window). You can also view the demo on YouTube (opens new window).
# Learn more
You can learn more about WebTransport with the following resources: