Skip to content

Commit d9672c6

Browse files
authored
WebTransport and Kubo (#1696)
1 parent 0f1ae8b commit d9672c6

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

docs/.vuepress/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ module.exports = {
203203
],
204204
'/how-to/kubo-garbage-collection',
205205
'/how-to/troubleshooting',
206+
'/how-to/webtransport',
206207
]
207208
},
208209
{

docs/how-to/webtransport.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: WebTransport and Kubo
3+
description: Learn how your files are broken down into blocks in IPFS and how to work with them.
4+
---
5+
6+
# WebTransport and Kubo
7+
8+
[WebTransport](https://docs.libp2p.io/concepts/transports/webtransport/), a new libp2p transport protocol, allows browsers to contact [Kubo](../install/command-line.md) 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.
9+
10+
Kubo v0.16 introduced [optional support for WebTransport](https://github.com/ipfs/kubo/releases?q=0.16.0&expanded=true#-webtransport-new-experimental-transport), and Kubo v0.18 [enabled support by default](https://github.com/ipfs/kubo/blob/release-v0.18/docs/changelogs/v0.18.md#webtransport-enabled-by-default).
11+
12+
## How it works
13+
14+
Conceptually, WebTransport is similar to [WebSocket](https://en.wikipedia.org/wiki/WebSocket). The browser can “upgrade” an [HTTP/2](https://en.wikipedia.org/wiki/HTTP/2) or an [HTTP/3 connection](https://en.wikipedia.org/wiki/HTTP/3), which runs on top of [QUIC](https://en.wikipedia.org/wiki/QUIC), 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:
15+
16+
- Speedy time to connect using a fast handshake (one network roundtrip).
17+
- Native stream multiplexing without head-of-line blocking.
18+
- Advanced loss recovery and congestion control.
19+
- Low latency communication.
20+
21+
### Steps
22+
23+
In a nutshell, WebTransport works with Kubo as follows:
24+
25+
1. The browser establishes a HTTP/3 connection to the Kubo node.
26+
1. It then opens a new stream.
27+
1. An Extended CONNECT request and proposed a WebTransport Session ID are sent.
28+
29+
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.
30+
31+
## Use cases
32+
33+
WebTransport in Kubo unlocks many use cases, including those listed below.
34+
35+
- Browser nodes or light clients can function as "full" peers in a decentralized network.
36+
- 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.
37+
- Browser extension cryptocurrency wallets can submit transactions directly to the blockchain.
38+
- Fetch data from the [DHT](../concepts/dht.md) by directly connecting to a DHT server node.
39+
- Upload to [Filecoin](https://docs.filecoin.io/) directly from the browser.
40+
- Decentralized peer-to-peer video streaming as a dApp.
41+
42+
## Using WebTransport with Kubo
43+
44+
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](https://github.com/libp2p/js-libp2p-webtransport/tree/main/examples/fetch-file-from-kubo). You can also view the demo on [YouTube](https://youtu.be/Dt42Ss6X_Vk?feature=shared&t=145).
45+
46+
## Learn more
47+
48+
You can learn more about WebTransport with the following resources:
49+
50+
- [libp2p documentation: WebTransport](https://docs.libp2p.io/concepts/transports/webtransport/)
51+
- [connectivity.libp2p.io](https://connectivity.libp2p.io/#webtransport)
52+
- [WebTransport spec](https://github.com/libp2p/specs/tree/master/webtransport)

0 commit comments

Comments
 (0)