【发布时间】:2019-07-04 09:37:06
【问题描述】:
我尝试使用 SSL 连接到 websocket 服务器。但总是在连接上失败(...)。 我是 cpprestsdk 的新手,我找不到有关如何将 SSL 信息设置为 websocket_client 的文档。
websocket_client_config config;
config.set_server_name("wss://host:port/v3/api");
websocket_client client(config);
auto fileStream = std::make_sharedconcurrency::streams::ostream();
pplx::task requestTask = fstream::open_ostream(U("results2.html"))
.then([&](ostream outFile)
{
*fileStream = outFile;
// Create http_client to send the request.
uri wsuri(U("wss://host:port/v3/api"));
client.connect(wsuri).wait();
websocket_outgoing_message msg;
msg.set_utf8_message(obj.serialize());
client.send(msg).wait();
printf("send success: %s\n", obj.serialize().c_str());
return client.receive().get();
})
它抛出“错误异常:set_fail_handler: 8: TLS 握手失败”。
【问题讨论】: