1
votes

Using the example code of boost::beast(https://www.boost.org/doc/libs/1_66_0/libs/beast/example/websocket/client/sync-ssl/websocket_client_sync_ssl.cpp), I got:

Error: WebSocket upgrade handshake failed

To make sure the server is ok, i created a test using https://www.websocket.org/echo.html, and it server responses fine. The url is wss://api.fcoin.com/v2/ws, and my settings:

host=api.fcoin.com;
port=443;
target=/v2/ws;

Could anyone help, please?

1

1 Answers

1
votes

The beast example uses target of /, not /v2/ws. If you want to connect to that endpoint, you need to modify the example. Change:

ws.handshake(host, "/");

to

ws.handshake(host, "/v2/ws");