-
-
Notifications
You must be signed in to change notification settings - Fork 35.7k
quic: add missing documentation for stream.stopSending() and stream.r… #63681
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2266,6 +2266,72 @@ The following body source types are supported: | |
| Throws `ERR_INVALID_STATE` if the outbound is already configured or if | ||
| the writer has been accessed. | ||
|
|
||
| ### `stream.resetStream([code])` | ||
|
|
||
| <!-- YAML | ||
| added: REPLACEME | ||
| --> | ||
|
|
||
| * `code` {number|bigint} The application error code to include in the | ||
| `RESET_STREAM` frame sent to the peer. Numbers are coerced to `BigInt`. | ||
| **Default:** `0n`. | ||
|
|
||
| Sends a `RESET_STREAM` frame to the peer, signalling that this end will | ||
| not send any more data on this stream. This half-closes the stream in the | ||
| WRITE direction only — the readable side (if any) is unaffected and can | ||
| continue receiving data from the peer. | ||
|
|
||
| If the stream has already been destroyed, this is a no-op. | ||
|
|
||
| This is useful for WebTransport and other application protocols that need | ||
| independent half-closing per direction without tearing down the entire | ||
| stream. | ||
|
|
||
| ```mjs | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Care to add a matching cjs code block? |
||
| import { connect } from 'node:quic'; | ||
|
|
||
| const session = await connect('localhost:4567', { alpn: 'myproto' }); | ||
| const stream = await session.createBidirectionalStream(); | ||
|
|
||
| // Abort the writable side with application error code 42. | ||
| stream.resetStream(42n); | ||
| ``` | ||
|
|
||
| See [Aborting a stream][] for an overview of all stream-abort APIs. | ||
|
|
||
| ### `stream.stopSending([code])` | ||
|
|
||
| <!-- YAML | ||
| added: REPLACEME | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| --> | ||
|
|
||
| * `code` {number|bigint} The application error code to include in the | ||
| `STOP_SENDING` frame sent to the peer. Numbers are coerced to `BigInt`. | ||
| **Default:** `0n`. | ||
|
|
||
| Sends a `STOP_SENDING` frame to the peer, requesting that the peer stop | ||
| sending data on this stream. This half-closes the stream in the READ | ||
| direction only — the writable side (if any) is unaffected and can | ||
| continue sending data to the peer. | ||
|
|
||
| If the stream has already been destroyed, this is a no-op. | ||
|
|
||
| This is useful for WebTransport and other application protocols that need | ||
| independent half-closing per direction without tearing down the entire | ||
| stream. | ||
|
|
||
| ```mjs | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
| import { connect } from 'node:quic'; | ||
|
|
||
| const session = await connect('localhost:4567', { alpn: 'myproto' }); | ||
| const stream = await session.createBidirectionalStream(); | ||
|
|
||
| // Tell the peer to stop sending with application error code 7. | ||
| stream.stopSending(7n); | ||
| ``` | ||
|
|
||
| See [Aborting a stream][] for an overview of all stream-abort APIs. | ||
|
|
||
| ### `stream.session` | ||
|
|
||
| <!-- YAML | ||
|
|
@@ -4447,6 +4513,8 @@ throughput issues caused by flow control. | |
| [`sessionOptions.sni`]: #sessionoptionssni-server-only | ||
| [`sessionOptions.token`]: #sessionoptionstoken-client-only | ||
| [`stream.destroy()`]: #streamdestroyerror-options | ||
| [`stream.resetStream()`]: #streamresetstreamcode | ||
| [`stream.stopSending()`]: #streamstopsendingcode | ||
| [`stream.headers`]: #streamheaders | ||
| [`stream.onerror`]: #streamonerror | ||
| [`stream.onwanttrailers`]: #streamonwanttrailers | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to have already been released, I am not sure when though