WebTransportDatagramDuplexStream: readable property
WebTransport API
WebTransport API
The readable read-only property of the WebTransportDatagramDuplexStream interface returns a ReadableStream instance that can be used to unreliably read incoming datagrams from the stream.
"Unreliably" means that transmission of data is not guaranteed, nor is arrival in a specific order. This is fine in some situations and provides very fast delivery. For example, you might want to transmit regular game state updates where each message supersedes the last one that arrives, and order is not important.
Value
A ReadableStream.
By default, this is a readable stream in which each chunk is a Uint8Array containing one datagram.
If the WebTransport was constructed with the datagramsReadableType option set to bytes, this is a readable byte stream.
A readable byte stream can also be read using a ReadableStreamBYOBReader, which reads each datagram into a buffer that you supply.
See the Reading datagrams with a BYOB reader example on the WebTransport() constructor page.
Examples
See the main WebTransportDatagramDuplexStream interface page.
Specifications
Browser compatibility
See also
- Using WebTransport
- WebSockets API
- Streams API
- WebTransport over HTTP/3