C++ 如何使用boost beast为websocket握手设置自定义标题
如何使用boost beast在WebSocket协议中发生的第一次握手中发送自定义头C++ 如何使用boost beast为websocket握手设置自定义标题,c++,boost,websocket,request-headers,beast,C++,Boost,Websocket,Request Headers,Beast,如何使用boost beast在WebSocket协议中发生的第一次握手中发送自定义头 我想在我的初始请求“x-custome-id:xxxxx”中使用custom头。您必须将custum头放在如下位置 您可能需要在这里或那里更改一些细节 ws_.async_handshake_ex(host, <endpoint>, [<somerequestname>](request_type& reqHead) {
我想在我的初始请求“x-custome-id:xxxxx”中使用custom头。您必须将custum头放在如下位置 您可能需要在这里或那里更改一些细节
ws_.async_handshake_ex(host, <endpoint>,
[<somerequestname>](request_type& reqHead) {
reqHead.insert(http::field::<sometype>,xxxxx);},
bind(Some handler));
ws.async握手(主机、,
[](请求类型和请求头){
reqHead.insert(http::field:,xxxxx);},
绑定(某个处理器);
注意:
您将获得这些详细信息,如主机
,端点
,等等
这就是您想要得到的-reqHead.insert(http::field::,xxxxx);}代码>在http::field::
探索解决方案。我发现候选解决方案如下。
但是,boost 1.69会出现编译器错误。
解决方案也解决了此问题。您好,欢迎使用SO。请阅读此页,并向我们展示您尝试使用的代码,包括显示哪些部分不起作用。谢谢您的帮助!