Re: [whatwg/streams] can streams be transferred via postMessage()? (#276)

It occurs to me that it might be a bit strange that for author-created duplex streams, the syntax is

```js
destination.postMessage(duplex, { transfer: [duplex.readable, duplex.writable] });
```

whereas for transform streams it is

```
destination.postMessage(transform, { transfer: [transform] });
```

I can't think of any nice solution for this though. Unfortunately the structured-serialize algorithm will throw for any platform object not explicitly marked as serializable (like a `TransformStream`), so to make the former syntax work for them we'd need make them `[Serializable]`. But that doesn't seem doable in general. It'd require new infrastructure in the structured clone algorithm I guess, which is probably not worth it.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/276#issuecomment-658295339

Received on Tuesday, 14 July 2020 16:57:52 UTC