w3c / webtransport

WebTransport is a web API for flexible data transport

Home Page:https://w3c.github.io/webtransport/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should incomingUni/BidirectionalStreams be "owning"?

jan-ivar opened this issue · comments

From #424 (comment) and #424 (comment):

Attempting to transfer wt.incomingUndirectionalStreams doesn't appear to work, as you say. When getReader() is called on the transferred readable stream of streams, the error is A ReadableStream could not be cloned because it was not transferred.

Sorry about this. Currently when a stream is transferred, the chunks that are passed through the stream are always cloned, never transferred. Since incomingUnidirectionalStreams is a stream of streams, each chunk is a stream, and streams can only be transferred, not cloned.

There was a plan to also support transferring the chunks (see Future Work) but without a concrete use case it never proceeded to the design stage.

whatwg/streams#1271 adds a new "owning" ReadableStream type, which allows for transferable chunks, albeit for a different purpose.

@ricea would making incomingUnidirectionalStreams and incomingBidirectionalStreams "owning" solve the DataCloneError, or is that a different part of the spec?

Currently the "owning" logic isn't wired up to the transferable streams logic. Once that is done, then it should work.

@ricea Do we have an issue open for that? Would it be different from whatwg/streams#1124?