New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editorial changes to transferable streams explainer #977
Editorial changes to transferable streams explainer #977
Conversation
ricea
commented
Dec 13, 2018
- Make some language clearer.
- Add a section about end-user benefit.
* Make some language clearer. * Add a section about end-user benefit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! I think this is an improvement. Ideally I'd like to see an example - like a snippet of an end-user story where this creates better perceived performance. Also note the word "jank" is also a bit buzzwordy. Something like "a webapp that incorporates a stream of data that doex XYZ would have better perceived performance because the processing of handling & decoding the stream could be offloaded onto another thread." ?
I opened up a TAG issue on this just to cross-refernece. I know you haven't requested formal TAG feedback on this yet - it's just so we can keep track of it and put it on the agenda for the next call. |
@torgo Sorry for the delay. How does the latest version look? |
I was a little concerned that Transferable Streams would make it pretty easy to route data around the cross-origin restriction, but I don't think this feature makes it much worse than it already is--namely, today an origin A can postMessage the received chunks from a ReadableStream to origin B's message handler. With this feature, only one postMessage is needed to pass the Stream, and then origin B can drink from the pipe for as long as it likes. I do think the explainer needs to support a better use-case than the general "workers make things easier", or "delegation is good". After all, the workaround for not having this feature is really trival--just make the request for Stream in the Worker/Frame instead (so the transfer is unnecessary). What are the use-cases where the Worker/Frame would be unable to implement that workaround? Why? (The only cases I can imagine are to enable easier cross-origin information sharing on the client.) |
Sure, since
(Disclaimer: if I sound slightly biased towards video-related use cases, that's probably because I work for a company in the online video industry. 😛 ) |
It's equivalent in power to a MessageChannel, so it doesn't weaken any security guarantees.
It is currently only an ergonomics win, although I hope to add optimisations in future exploiting the fact that the platform understands the semantics of the transfer. I think it opens up the benefits of offloading work to a larger audience, and that's where the end-user benefit comes from. I will try to incorporate @MattiasBuelens's examples into the explainer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spotted a few typos. Looks good though! 👍