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]);
For almost a year, between #307 and #395 (nevermind #423), the following streams were transferable streams:
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:If we don't then the above will fail, and apps would have to work around it like this instead instead: