A client.connect(web::uri)
is required, but after looking into web::uri
it won't accept a string. The api seems to say it can accept a string, but it won't and I can't figure out why.
#include <iostream>
#include <stdio.h>
#include <cpprest/ws_client.h>
using namespace std;
using namespace web;
using namespace web::websockets::client;
int main(int argc, char **args) {
uri link = uri("ws://echo.websocket.org"); //PROBLEM LINE
websocket_client client;
client.connect(link).wait();
websocket_outgoing_message out_msg;
out_msg.set_utf8_message("test");
client.send(out_msg).wait();
client.receive().then([](websocket_incoming_message in_msg) {
return in_msg.extract_string();
}).then([](string body) {
cout << body << endl;
}).wait();
client.close().wait();
return 0;
}