Skip to content

Commit 3cacf44

Browse files
author
Vishal Ranaut
committed
doc: add API documentation for the experimental quic module
1 parent 437760d commit 3cacf44

1 file changed

Lines changed: 30 additions & 2 deletions

File tree

doc/api/quic.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2269,7 +2269,7 @@ the writer has been accessed.
22692269
### `stream.resetStream([code])`
22702270

22712271
<!-- YAML
2272-
added: REPLACEME
2272+
added: v26.2.0
22732273
-->
22742274

22752275
* `code` {number|bigint} The application error code to include in the
@@ -2297,12 +2297,26 @@ const stream = await session.createBidirectionalStream();
22972297
stream.resetStream(42n);
22982298
```
22992299

2300+
```cjs
2301+
const { connect } = require('node:quic');
2302+
2303+
async function main() {
2304+
const session = await connect('localhost:4567', { alpn: 'myproto' });
2305+
const stream = await session.createBidirectionalStream();
2306+
2307+
// Abort the writable side with application error code 42.
2308+
stream.resetStream(42n);
2309+
}
2310+
2311+
main();
2312+
```
2313+
23002314
See [Aborting a stream][] for an overview of all stream-abort APIs.
23012315

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

23042318
<!-- YAML
2305-
added: REPLACEME
2319+
added: v26.2.0
23062320
-->
23072321

23082322
* `code` {number|bigint} The application error code to include in the
@@ -2330,6 +2344,20 @@ const stream = await session.createBidirectionalStream();
23302344
stream.stopSending(7n);
23312345
```
23322346

2347+
```cjs
2348+
const { connect } = require('node:quic');
2349+
2350+
async function main() {
2351+
const session = await connect('localhost:4567', { alpn: 'myproto' });
2352+
const stream = await session.createBidirectionalStream();
2353+
2354+
// Tell the peer to stop sending with application error code 7.
2355+
stream.stopSending(7n);
2356+
}
2357+
2358+
main();
2359+
```
2360+
23332361
See [Aborting a stream][] for an overview of all stream-abort APIs.
23342362

23352363
### `stream.session`

0 commit comments

Comments
 (0)