Closed SebMeunier closed 4 years ago
Sounds like you are using a non-SSL server and trying to accept SSL clients. Try using this example instead: https://github.com/boostorg/beast/tree/develop/example/websocket/server/sync-ssl
Hi @vinniefalco
Thanks for the quick answer. Removing the wss part in the JS client definitely helped to make the connection, as I don't really need SSL here.
Since I'm here, you might be able to give me some advice on the best approach for my use case:
As I embedded the server sync code in a class but the "session" is created in a thread, I'm not sure how I can keep a reference on the opened connections/sockets to be able to write my messages from my class.
Thanks for any help / suggestion you may have here.
Seb
This example implements broadcasting: https://github.com/boostorg/beast/tree/develop/example/websocket/server/chat-multi
This issue has been open for a while with no activity, has it been resolved?
Sorry for the late news. Thanks again @vinniefalco for your help, it works like a charm with your last sample.
Hi!
Version of Beast: 266
All relevant compiler information: Using Visual Studio 2017
Steps necessary to reproduce the problem
I just used the sample websocket_server_sync.cpp and tried to connect from https://www.websocket.org/echo.html
I ran the server code with
127.0.0.1 2974
as arguments from VS debuggerI tried to connect from https://www.websocket.org/echo.html with either:
I always get a "Bad method" system_error at the ws.accept();
I also tried with a C# client I have written that works with another WS server, I get this error log on the client side:
Error|WebSocket.doHandshake|Includes an invalid Sec-WebSocket-Protocol header.
Client code
I am not a C++ developer (anymore) but I need to create a simple websocket server that will send a message to connected client(s)
I might be missing something obvious in the server configuration, such as the "target name"? or "service name"? but some help would appreciated.
Thanks.
Seb