Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

Commented Unassigned: get error when connect to websocket via proxy [347]

$
0
0
Hi,

I used casablanca(development branch lastest commit) to connect with websocket server via proxy.

```
websocket_callback_client client;
websocket_client_config client_config;
web::web_proxy wp(U("http://myproxyserver:8080"));
credentials cred("username","password");
wp.set_credentials(cred);
client_config.set_proxy(wp);
client = websocket_callback_client(client_config);

pplx::task<void> connectTask = client.connect(U(uri));
try {
connectTask.wait();
cout << "Connect success!" <<endl;

// Handle receive message

});

// Handle closing connection
client.set_close_handler([](websocket_close_status status, utility::string_t reason, std::error_code errCode) {
printf("Error exception:%s \n", errCode.message().c_str());
});

} catch (websocket_exception &e) {
}
```
unfortunately, after connect to server, immediately this connection was be closed, and throw this message "__Error exception:Undefined error: 0__"

All suggestions are welcome.
Thank you in advance.


Comments: Hi najp, What is the websocket_close_status parameter value in when the close handler is being executed? Also does the connectTask successfully complete? Does the text "Connect success!" get printed to the console? Steve

Viewing all articles
Browse latest Browse all 4845

Trending Articles