Comments (3)
Thx, your solution is working properly, i'm going to close this issue.
from beast.
How about this:
class set_subprotocols
{
std::string s_;
public:
explicit
set_subprotocols(std::string s)
: s_(s) {}
template<bool isRequest, class Body, class Headers>
void
operator()(beast::http::message<isRequest, Body, Headers>& m) const
{
m.fields.replace("Sec-WebSocket-Protocol", s_);
}
};
using namespace beast::websocket;
stream<boost::ip::tcp::socket> ws;
...
ws.set_option(decorate(set_subprotocols{"mqtt"}));
I believe this works in the current version, see:
http://vinniefalco.github.io/beast/beast/ref/websocket__decorate.html
NOTE The operator()
must be declared as const
in the latest versions of Beast! (edited)
from beast.
Glad to hear it!
from beast.
Related Issues (20)
- Send data through a websocket connection from a separated thread HOT 4
- Using /O1 optimization in vs2017 will trigger a crash HOT 6
- [Help] Correctly handle message loop on idle websocket connection HOT 16
- Multiple web socket client issues HOT 18
- `zlib::deflate_stream::write` documentation wall of text HOT 1
- Discarding request body without needing a temporary buffer HOT 6
- Ergonomics of error list in `http::async_read` and `http::async_read_header` HOT 4
- Suggestion: Make incremental HTTP reading as easy as incremental HTTP writing HOT 7
- ecorm's List of Pain Points HOT 14
- multiplexing HOT 6
- p0-.,\ HOT 1
- resolver.async_resolve hang issue HOT 2
- http::async_read hides client disconnection errors HOT 7
- http client tcp ssl stream async_shutdown blocks forever HOT 13
- Double definition of zlib DEF_MEM_LEVEL HOT 2
- Multiple unreachable code warnings if compiling with /W4 in VS2022 HOT 4
- Hi
- Hi,
- Facing error while running advanced_server.cpp file in centos 9. HOT 41
- http_client_sync example hangs on uploading ~2GB multipart data HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from beast.