Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webtransport: add a page for the client #43

Merged
merged 3 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions content/docs/webtransport/client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: Running a Client
toc: true
weight: 2
---

To dial a WebTransport session, initialize a `webtransport.Dialer`, and call the `Dial` function.

```go
var d webtransport.Dialer
// optionally, add custom headers
var headers http.Header
headers.Add("foo", "bar")
rsp, sess, err := d.Dial(ctx, "https://example.com/webtransport", headers)
// err is only nil if rsp.StatusCode is a 2xx
// Handle the session. Here goes the application logic.
```

This initiates a new WebTransport session with the server by sending an Extended CONNECT request to the server.
The server might reject this request, in which case the status code of the HTTP response will not be in the 2xx range.

The parameters for the underlying QUIC connection can be adjusted by setting the `QUICConfig` on the `Dialer`. [Datagram support]({{< relref "../quic/datagrams.md" >}}) is required by WebTransport, and must be enabled on using `quic.Config.EnableDatagrams`.

## 📝 Future Work

* Using the same QUIC connection for WebTransport and HTTP/3: [#147](https://github.com/quic-go/webtransport-go/issues/147)
* Allow Optimistic Opening of Streams: [#136](https://github.com/quic-go/webtransport-go/issues/136)
* Subprotocol Negotiation: [#132](https://github.com/quic-go/webtransport-go/issues/132)
2 changes: 1 addition & 1 deletion content/docs/webtransport/server.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Running a WebTransport Server
title: Running a Server
toc: true
weight: 1
---
Expand Down