开发者

pion::net HTTPServer persistent connections

开发者 https://www.devze.com 2023-03-02 08:08 出处:网络
I\'m working on a low-latency high-throughput, minimalistic HTTP server (almost real-time message switch).

I'm working on a low-latency high-throughput, minimalistic HTTP server (almost real-time message switch).

I'm very fond of pion::net, and I've seen numerous references that it supports persistent connections (thus potentially saving the whole TCP ordeal):

http://boost.2283326.n4.nabble.com/Boost-HTTP-t开发者_StackOverflowd2637928.html

Could anyone point me in the right direction on how to use pion::net that way?


Persistence is a property of TCPConnection (see the setLifecycle method). So if you choose to go the WebServer / Webservice route set the Lifecycle property accordingly in WebService::operator().
Also, since you're talking HTTP you should set the connection persistence according to the info the client sends you (namely the HTTP version and the value of the Connection header).

0

精彩评论

暂无评论...
验证码 换一张
取 消