Back to Content

WebTransportSendStream

files/en-us/web/api/webtransportsendstream/index.md

latest2.6 KB
Original Source

{{APIRef("WebTransport API")}}{{securecontext_header}} {{AvailableInWorkers}}

The WebTransportSendStream interface of the {{domxref("WebTransport API", "WebTransport API", "", "nocode")}} is a specialized {{domxref("WritableStream")}} that is used to send outbound data in both unidirectional or bidirectional {{domxref("WebTransport")}} streams.

The send stream is a writable stream of Uint8Array, that can be written to in order to send data to a server. It additionally provides streaming features such as setting the send order, and getting stream statistics.

Objects of this type are not constructed directly. When creating a unidirectional stream the {{domxref("WebTransport.createUnidirectionalStream()")}} returns an object of this type for sending data. When creating a bidirectional stream using {{domxref("WebTransport.createBidirectionalStream()")}}, the method returns a {{domxref("WebTransportBidirectionalStream")}}, and the send stream object can be obtained from its {{domxref("WebTransportBidirectionalStream.writable", "writable")}} property. When a bidirectional stream is initiated by the remote end, an object of this type can similarly be obtained using {{domxref("WebTransport.incomingBidirectionalStreams")}}.

WebTransportSendStream is a transferable object.

{{InheritanceDiagram}}

Instance properties

Also inherits properties from its parent interface, {{domxref("WritableStream")}}.

  • {{domxref("WebTransportSendStream.getStats()")}}
    • : Returns a {{jsxref("Promise")}} that resolves with statistics related to this stream.

Instance methods

Also inherits methods from its parent interface, {{domxref("WritableStream")}}.

<!-- WebTransportSendStream.sendGroup not implemented in any browser -->
  • {{domxref("WebTransportSendStream.sendOrder")}}
    • : Indicates the send priority of this stream relative to other streams for which the value has been set.

Examples

See WebTransport.incomingUnidirectionalStreams for an example of how to get a {{domxref("ReadableStream")}} of WebTransportSendStream objects.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also