userver-framework / userver

Production-ready C++ Asynchronous Framework with rich functionality
https://userver.tech
Apache License 2.0
2.37k stars 275 forks source link

Websocket proposal: simplify bi-directional implementation #660

Closed Turim closed 1 month ago

Turim commented 1 month ago

I'd like to raise a discussion related to WS duplex implementation Currently duplex is implemented having 2 tasks sharing connection, common resources (Spsc queue etc):

https://github.com/userver-framework/userver/blob/0762adcd2fa9c33aad71945c6469eac3ec22d625/core/functional_tests/websocket/service.cpp#L65-L89

But internally we know for sure that they operate on the same socket, which just don't give up the control flow.

The proposal aims to simplify the client's code: