How to send custom headers in the first handshake that occurs in the WebSocket protocol with boost beast ?
I want to use custom header in my initial request "x-custome-id : xxxxx".
You will have to put the custum header somthing like this
You might want to change a few details here and there
ws_.async_handshake_ex(host, <endpoint>,
[<somerequestname>](request_type& reqHead) {
reqHead.insert(http::field::<sometype>,xxxxx);},
bind(Some handler));
Note:
you will have theses details like host
, endpoint
,etc
This is what you want to get right - reqHead.insert(http::field::<sometype>,xxxxx);}
Explore the option suitable for you in http::field::<sometype>
explore the enum class field : unsigned short for this.
I've found the candidate solution as https://github.com/boostorg/beast/issues/70 .
But, this occurs compiler error with boost 1.69.
This issue also fixed with the solution https://github.com/boostorg/beast/issues/1470 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.