@@ -307,9 +307,9 @@ separate APIs for creating each kind:
307307[ ` session.createUnidirectionalStream() ` ] [ ] . Streams initiated by a remote
308308peer are delivered via the [ ` session.onstream ` ] [ ] callback. When the
309309negotiated application protocol supports the stream-level callbacks (e.g.
310- HTTP/3) and any of them are configured, incoming streams can instead be
311- consumed entirely through those callbacks (such as ` onheaders ` ) and
312- registering ` onstream ` is optional.
310+ HTTP/3) and an ` onheaders ` callback is configured, incoming streams can
311+ instead be consumed entirely through it and registering ` onstream ` is
312+ optional.
313313
314314There are two ways to write data to a stream:
315315
@@ -414,8 +414,8 @@ A typical client session progresses through these stages:
414414On the server side, call [ ` quic.listen() ` ] [ ] with a callback. The callback
415415fires for each incoming session after the TLS handshake begins. Incoming
416416streams arrive via the [ ` session.onstream ` ] [ ] callback, or, for HTTP/3
417- sessions with stream-level callbacks configured, directly through those
418- callbacks (see the [ minimal HTTP/3 server] [ ] example).
417+ sessions with an ` onheaders ` callback configured, directly through that
418+ callback (see the [ minimal HTTP/3 server] [ ] example).
419419
420420[ ` session.destroy() ` ] [ ] is available for immediate teardown — all open streams
421421are destroyed and the session is closed without waiting for them to finish.
@@ -1117,11 +1117,13 @@ added: v23.8.0
11171117The callback to invoke when a new stream is initiated by a remote peer. Read/write.
11181118
11191119If no ` onstream ` callback is set and the stream has no other consumer, an
1120- incoming stream is destroyed on arrival and a warning is emitted. Stream-level
1121- callbacks (such as ` onheaders ` ) count as a consumer when the negotiated
1122- application protocol supports them (e.g. HTTP/3), so an HTTP/3 server that
1123- handles requests entirely through those callbacks does not need to set
1124- ` onstream ` .
1120+ incoming stream is destroyed on arrival and a warning is emitted. An
1121+ ` onheaders ` callback counts as a consumer when the negotiated application
1122+ protocol supports it (e.g. HTTP/3), because it is invoked for every incoming
1123+ request stream. Other stream-level callbacks (` ontrailers ` , ` oninfo ` ,
1124+ ` onwanttrailers ` ) do not, since they are conditional or outbound-only and
1125+ would leave the stream unobservable. An HTTP/3 server that handles requests
1126+ entirely through ` onheaders ` does not need to set ` onstream ` .
11251127
11261128### ` session.ondatagram `
11271129
@@ -4023,7 +4025,7 @@ const encoder = new TextEncoder();
40234025const endpoint = await listen ((session ) => {
40244026 // The session.onstream callback fires for each new client-initiated
40254027 // stream. It is optional here: with `onheaders` configured below,
4026- // request streams are consumed through the stream-level callbacks .
4028+ // request streams are consumed through that callback .
40274029}, {
40284030 sni: { ' *' : { keys: [defaultKey], certs: [defaultCert] } },
40294031 // ALPN defaults to 'h3'.
0 commit comments