session.createBidirectionalStream([options])
options<Object>body<string> | <ArrayBuffer> | <SharedArrayBuffer> | <ArrayBufferView> | <Blob> | <FileHandle> | <AsyncIterable> | <Iterable> | <Promise> | <null> 出站主体来源。有关支持的类型,请参见stream.setBody()。若省略,流将以半关闭状态开始(可写端打开,无主体排队)。headers<Object> 要发送的初始请求或响应头。仅在会话支持头时使用(例如 HTTP/3)。如果未指定body且提供了headers,则流将被视为仅包含头(终端)。priority<string> 流的优先级别。可选值为'high'、'default'或'low'。默认值:'default'。incremental<boolean> 当true时,该流的数据可能会与同一优先级的其他流的数据交错。 当false时,该流应在同优先级的同伴之前完成。 默认:false。highWaterMark<number> 在writeSync()返回false之前,写入器将缓冲的最大字节数。当缓冲的数据超过此限制时,调用者应在写入更多数据之前等待清空。默认值:65536(64 KB)。onheaders<Function> 接收到初始响应头时的回调。 使用(headers)调用。ontrailers<Function> 接收尾部头的回调。调用时使用(trailers)。oninfo<Function> 收到信息性(1xx)头时的回调。使用(headers)调用。onwanttrailers<Function> 当应发送标尾时的回调。调用时不带参数;在回调中使用stream.sendTrailers()。
- 返回:<Promise> 用于 quic.QuicStream
打开一个新的双向流。如果未指定 body 选项,传出流将被半关闭。priority 和 incremental 选项仅在会话支持优先级时使用(例如 HTTP/3)。headers、onheaders、ontrailers、oninfo 和 onwanttrailers 选项仅在会话支持头部时使用(例如 HTTP/3)。
🌐 Open a new bidirectional stream. If the body option is not specified,
the outgoing stream will be half-closed. The priority and incremental
options are only used when the session supports priority (e.g. HTTP/3).
The headers, onheaders, ontrailers, oninfo, and onwanttrailers
options are only used when the session supports headers (e.g. HTTP/3).