如何使用boost野兽在WebSocket协议中发生的第一次握手中发送自定义标头?
我想在我的初始请求“x-custom-id:xxxxx”中使用自定义标头。
你必须把自定义标题放在这样的东西上
你可能想在这里和那里改变一些细节
ws_.async_handshake_ex(host, <endpoint>,
[<somerequestname>](request_type& reqHead) {
reqHead.insert(http::field::<sometype>,xxxxx);},
bind(Some handler));
注意:
你会得到像qazxsw poi,qazxsw poi等这些细节
这就是你想要的 - host
探索适合你的选择endpoint
探索reqHead.insert(http::field::<sometype>,xxxxx);}
。
我发现候选解决方案为http::field::<sometype>
。
但是,这会发生编译器错误,增强1.69。
这个问题也解决了enum class field : unsigned short解决方案。