Skip to content
Open
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
96 changes: 96 additions & 0 deletions doc/api/quic.md
Original file line number Diff line number Diff line change
Expand Up @@ -2281,6 +2281,100 @@ 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: v26.2.0
Copy link
Copy Markdown
Member

@mertcanaltin mertcanaltin Jun 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
added: v26.2.0
added: v23.8.0

Thanks for contribution!,

I see publish this methods (resetStream,stopSending) in node v23.8.0 #57005 #56328

-->

* `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
Comment thread
vishalranaut marked this conversation as resolved.
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);
```

```cjs
const { connect } = require('node:quic');

async function main() {
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);
}

main();
```

See [Aborting a stream][] for an overview of all stream-abort APIs.

### `stream.stopSending([code])`

<!-- YAML
added: v26.2.0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

-->

* `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
Comment thread
vishalranaut marked this conversation as resolved.
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);
```

```cjs
const { connect } = require('node:quic');

async function main() {
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);
}

main();
```

See [Aborting a stream][] for an overview of all stream-abort APIs.

### `stream.session`

<!-- YAML
Expand Down Expand Up @@ -4462,6 +4556,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
Expand Down