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

docs: update WebTransport unidirectional stream examples #37629

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

achingbrain
Copy link
Contributor

Description

The WebTransport createUnidirectionalStream method returns a promise of a WebTransportSendStream (which extends WritableStream), not an object with a .writable property.

So the developer can call getWriter directly on the resolved result of the promise instead of .writable.getWriter as with bidirectional streams.

Motivation

The examples are wrong.

Additional details

The WebTransport `createUnidirectionalStream` method returns a promise of a `WebTransportSendStream` (which extends `WritableStream`), not an object with a `.writable` property.

So the developer can call `getWriter` directly on the resolved result of the promise instead of `.writable.getWriter` as with bidirectional streams.

Refs:

- [WebTransport.createUnidirectionalStream](https://www.w3.org/TR/webtransport/#dom-webtransport-createunidirectionalstream)
- [WebTransportSendStream](https://www.w3.org/TR/webtransport/#webtransportsendstream)
@achingbrain achingbrain requested a review from a team as a code owner January 13, 2025 12:56
@achingbrain achingbrain requested review from sideshowbarker and removed request for a team January 13, 2025 12:56
@github-actions github-actions bot added Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed labels Jan 13, 2025
@sideshowbarker sideshowbarker merged commit 5e4aa22 into mdn:main Jan 13, 2025
8 checks passed
Copy link
Contributor

@sideshowbarker
Copy link
Member

Alex, nice catch 〜 congrats on landing your first docs change here — welcome aboard 🎉

@achingbrain achingbrain deleted the patch-1 branch January 13, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants