Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
Fix part, which do not match the current spec (#8609)
Browse files Browse the repository at this point in the history
* Fix part, which do not match the current spec

* chore: trigger github actions

Co-authored-by: Matthias Rohmer <mrohmer@google.com>
  • Loading branch information
martenrichter and matthiasrohmer committed Nov 23, 2022
1 parent 9d3468d commit 14e6717
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/site/content/en/blog/webtransport/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ await writer.abort();

#### ReceiveStream

A <code>[ReceiveStream](https://wicg.github.io/web-transport/#receivestream)</code> is initiated by the server. Obtaining a <code>ReceiveStream</code> is a two-step process for a web client. First, it calls the <code>receiveStreams()</code> method of a `WebTransport` instance, which returns a <code>ReadableStream</code>. Each chunk of that <code>ReadableStream</code>, is, in turn, a <code>ReceiveStream</code> that can be used to read <code>Uint8Array</code> instances sent by the server.
A <code>[ReceiveStream](https://wicg.github.io/web-transport/#receivestream)</code> is initiated by the server. Obtaining a <code>ReceiveStream</code> is a two-step process for a web client. First, it calls the <code>incomingUnidirectionalStreams</code> attribute of a `WebTransport` instance, which returns a <code>ReadableStream</code>. Each chunk of that <code>ReadableStream</code>, is, in turn, a <code>ReceiveStream</code> that can be used to read <code>Uint8Array</code> instances sent by the server.

```js
async function readFrom(receiveStream) {
Expand All @@ -228,7 +228,7 @@ async function readFrom(receiveStream) {
}
}

const rs = transport.receiveStreams();
const rs = transport.incomingUnidirectionalStreams;
const reader = rs.getReader();
while (true) {
const {done, value} = await reader.read();
Expand Down Expand Up @@ -265,10 +265,10 @@ const stream = await transport.createBidirectionalStream();
// stream.writable is a WritableStream
```

You can listen for a `BidirectionalStream` created by the server with the `receiveBidirectionalStreams()` method of a `WebTransport` instance, which returns a `ReadableStream`. Each chunk of that `ReadableStream`, is, in turn, a `BidirectionalStream`.
You can listen for a `BidirectionalStream` created by the server with the `incomingBidirectionalStreams` attribute of a `WebTransport` instance, which returns a `ReadableStream`. Each chunk of that `ReadableStream`, is, in turn, a `BidirectionalStream`.

```js
const rs = transport.receiveBidrectionalStreams();
const rs = transport.incomingBidirectionalStreams;
const reader = rs.getReader();
while (true) {
const {done, value} = await reader.read();
Expand Down

0 comments on commit 14e6717

Please sign in to comment.