-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
webtransport: add a page about streams
- Loading branch information
1 parent
194a481
commit d289599
Showing
3 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: WebTransport Session | ||
title: Session | ||
toc: true | ||
weight: 3 | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
title: Streams | ||
toc: true | ||
weight: 4 | ||
--- | ||
|
||
A WebTransport stream functions similarly to a [QUIC Stream]({{< relref "../quic/streams.md" >}}). In particular, the stream state machines are exactly the same, as detailed in the [QUIC Stream documentation]({{< relref "../quic/streams.md#states" >}}). WebTransport supports both unidirectional and bidirectional streams. | ||
|
||
The main difference between a QUIC stream and a WebTransport stream lies in the type of error codes used to reset the stream: QUIC allows error codes up to a 62-bit unsigned integer, while WebTransport error codes are limited to a 32-bit unsigned integer. | ||
|
||
|
||
## Stream Errors | ||
|
||
When a stream is reset (i.e. when `CancelRead` or `CancelWrite` are used), applications can communicate an error code to the peer. Subsequent calls to Read and Write may return an error that can be type-asserted as a `quic.StreamError`. | ||
|
||
WebTransport itself does not interpret this value; instead, it is the responsibility of the application layer to assign specific meanings to different error codes. | ||
|
||
Below is an example of how to type-assert an error as a `webtransport.StreamError`: | ||
|
||
```go | ||
var streamErr *webtransport.StreamError | ||
if errors.As(err, &streamErr) { | ||
errorCode := streamErr.ErrorCode | ||
} | ||
``` |