Re: [whatwg/fetch] Developer-controlled streams for request/response (#88)

I have played around with and implemented bi-directional streaming for both HTTP/1 and HTTP/2 in `async-http`.

While it's not possible to demonstrate in a web browser, here is a simple example of streaming from the server to the client: https://utopia-falcon-heroku.herokuapp.com/welcome/index

In addition, using the `async-http` API directly, it's possible to write applications that stream in both directions, and in theory there is no reason why a web-browser couldn't do it too.

> For H1, you'd just close the connection. For H2, you'd cancel the stream.

In some cases you can optimise this logic to avoid closing the connection, but this is roughly what `async-http` ended up doing.

> most will 411 (Length Required) if there's no Content-Length

`async-http` and by composition, `falcon` (web server) both accept chunked request body. In addition, `falcon` accepts non-content-length bodies, but you must use TCP's `shutdown(WR)` functionality in order to signal the end of the body. With these bits in place, it's possible to have quite decent HTTP/1 bi-directional streaming, even for (a slightly extended at the TCP layer) HTTP/1.0!

I also implemented support for WebSockets, and it's such an orthogonal concept, especially in the design of the server, that I really believe and hope that we can build something better directly on top of HTTP/2. WebSockets seems like a step in the wrong direction.

-- 
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/fetch/issues/88#issuecomment-427202703

Received on Thursday, 4 October 2018 23:37:54 UTC