Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/127.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何使用boost beast为websocket握手设置自定义标题_C++_Boost_Websocket_Request Headers_Beast - Fatal编程技术网

C++ 如何使用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) {

如何使用boost beast在WebSocket协议中发生的第一次握手中发送自定义头


我想在我的初始请求“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。请阅读此页,并向我们展示您尝试使用的代码,包括显示哪些部分不起作用。谢谢您的帮助!