Skip to content

Should WebTransportSendStream and WebTransportReceiveStream be transferable? #424

Description

@jan-ivar

For almost a year, between #307 and #395 (nevermind #423), the following streams were transferable streams:

let {readable, writable} = await wt.createBidirectionalStream();

writable = await wt.createUnidirectionalStream();

for await (readable of wt.incomingUnidirectionalStreams)

But right now they're not, since "Platform objects can be transferable objects if their primary interface is decorated with the [Transferable] IDL extended attribute."

Q: Should they be? This would allow .getStats() to be called where data is read and written, as well as make this allowed:

const wt = new WebTransport(url);
const {readable, writable} = await wt.createBidirectionalStream();
sendWorker.postMessage({writable}, [writable]);
receiveWorker.postMessage({readable}, [readable]);

If we don't then the above will fail, and apps would have to work around it like this instead instead:

const wt = new WebTransport(url);
const wts = await wt.createBidirectionalStream();
const sendable = new TransformStream(), receivable = new TransformStream();
sendable.pipeTo(wts.writable);
wts.readable.pipeTo(receivable.writable);
sendWorker.postMessage({sendable}, [sendable]);
receiveWorker.postMessage({receivable}, [receivable]);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions