On 07/07/2017 01:49 AM, Vinnie Falco via Boost wrote:
Ah! I see the confusion now. Both HTTP and WebSocket in Beast operate on stream algorithms. However, a WebSocket session has state whose lifetime must be managed. HTTP/1 does not. Beast's interface for HTTP operations uses simple free functions, while the WebSocket interface
Are HTTP operations really stateless? How does FieldsReader's chunked and keep_alive fit into this picture?
Due to the requirements of HTTP/2 (over-engineered and overly complex in my opinion) it is not possible to provide a synchronous implementation. And unfortunately the implementation must depart from Beast's philosophy of leaving some things up to the user, a full HTTP/2 implementation must take over the "read pump" in order to enforce stream prioritization.
I assume that you are thinking about HTTP/2 multiplexing here. The situation is somewhat similar to unconnected UDP sockets, where you can receive datagrams from multiple endpoints on the same socket. It is possible to emulate connected UDP sockets (you can also make UDP socket connected directly, but it has some unwanted consequences) with pseudo- sockets that appear to be connected to a single endpoint even if it communications over an unconnected UDP socket. Here is an example of that: https://github.com/breese/trial.datagram