Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2020-07-14 06:28:01 +0300
committerJames M Snell <jasnell@gmail.com>2020-07-23 16:52:47 +0300
commit83bf0d7e8cf39c49750cf527f331cdf6b5f4f225 (patch)
treefcec53c416113bd38592bbae71bde81fc6bbb8f3 /doc/api/quic.md
parenta65296db2c544df91e0f6c8cbc8ff79691f870fe (diff)
quic: remove unneeded quicstream.aborted and fixup docs
PR-URL: https://github.com/nodejs/node/pull/34351 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'doc/api/quic.md')
-rw-r--r--doc/api/quic.md44
1 files changed, 11 insertions, 33 deletions
diff --git a/doc/api/quic.md b/doc/api/quic.md
index af30e251f82..c877cd12a6f 100644
--- a/doc/api/quic.md
+++ b/doc/api/quic.md
@@ -25,17 +25,9 @@ const { createQuicSocket } = require('net');
// Create the QUIC UDP IPv4 socket bound to local IP port 1234
const socket = createQuicSocket({ endpoint: { port: 1234 } });
-socket.on('session', (session) => {
+socket.on('session', async (session) => {
// A new server side session has been created!
- session.on('secure', () => {
- // Once the TLS handshake is completed, we can
- // open streams...
- const uni = session.openStream({ halfOpen: true });
- uni.write('hi ');
- uni.end('from the server!');
- });
-
// The peer opened a new stream!
session.on('stream', (stream) => {
// Let's say hello
@@ -46,6 +38,10 @@ socket.on('session', (session) => {
stream.on('data', console.log);
stream.on('end', () => console.log('stream ended'));
});
+
+ const uni = await session.openStream({ halfOpen: true });
+ uni.write('hi ');
+ uni.end('from the server!');
});
// Tell the socket to operate as a server using the given
@@ -187,10 +183,10 @@ The `openStream()` method is used to create a new `QuicStream`:
```js
// Create a new bidirectional stream
-const stream1 = session.openStream();
+const stream1 = await session.openStream();
// Create a new unidirectional stream
-const stream2 = session.openStream({ halfOpen: true });
+const stream2 = await session.openStream({ halfOpen: true });
```
As suggested by the names, a bidirectional stream allows data to be sent on
@@ -1045,12 +1041,12 @@ added: REPLACEME
* `defaultEncoding` {string} The default encoding that is used when no
encoding is specified as an argument to `quicstream.write()`. Default:
`'utf8'`.
-* Returns: {QuicStream}
+* Returns: {Promise} containing {QuicStream}
-Returns a new `QuicStream`.
+Returns a `Promise` that resolves a new `QuicStream`.
-An error will be thrown if the `QuicSession` has been destroyed or is in the
-process of a graceful shutdown.
+The `Promise` will be rejected if the `QuicSession` has been destroyed or is in
+the process of a graceful shutdown.
#### `quicsession.ping()`
<!--YAML
@@ -2153,14 +2149,6 @@ stream('trailingHeaders', (headers) => {
added: REPLACEME
-->
-#### `quicstream.aborted`
-<!-- YAML
-added: REPLACEME
--->
-* Type: {boolean}
-
-True if dataflow on the `QuicStream` was prematurely terminated.
-
#### `quicstream.bidirectional`
<!--YAML
added: REPLACEME
@@ -2281,16 +2269,6 @@ added: REPLACEME
The maximum received offset for this `QuicStream`.
-#### `quicstream.pending`
-<!-- YAML
-added: REPLACEME
--->
-
-* {boolean}
-
-This property is `true` if the underlying session is not finished yet,
-i.e. before the `'ready'` event is emitted.
-
#### `quicstream.pushStream(headers\[, options\])`
<!-- YAML
added: REPLACEME