HTTP Pipelining vs. WebSocket in Boost.Beast advanced server example

时间:2018-02-05 12:57:15

标签: c++ http boost websocket beast

I have a question to this Boost.Beast example:

https://github.com/boostorg/beast/blob/908f84cb3c023ed7c5bd19e2e5283d3218a6d820/example/advanced/server/advanced_server.cpp

In line 643 a WebSocket upgrade is done. However, if I understand it correctly, there may still be HTTP write commands in the queue that are asynchronously executed. They are thus executed in parallel to the current WebSocket communication. Is that legal? Or have I not yet fully understood the example?

1 个答案:

答案 0 :(得分:0)

在发送101个交换协议响应后发送HTTP响应是不合法的。但这不可能发生,因为只要服务器收到升级HTTP请求,它就会遵循升级过程。发送升级请求后发送另一个正常HTTP请求的客户端将出错。