c++boostboost-beastbeast-websockets

Boost beast manipulate http response headers durring accept


I would like to manipulate the http response sent to the websocket client durring accept.

I've read the examples and the manual, I can pare the request, check if it's a websocket upgrade request, but I can't manipulate the response.

It would be nice to have the websocket library to prepare the response, let me send it out and then take over the socket and start from there.


Solution

  • Use a "decorator" to modify the response before it is sent: https://www.boost.org/doc/libs/1_69_0/libs/beast/doc/html/beast/using_websocket/handshaking_servers.html#beast.using_websocket.handshaking_servers.decorators