APPCRUSH

Sep 17, 2015 at 3:40 AM
I create simple websocket project and have some troubles after send msg, or after recieve 2 or more messages from server my app crush.
Module with error: cpprest120d_2_6.dll
I using MSVS2013 with update5. Need your help!

include <cpprest/ws_client.h>

include <iostream>

using namespace web;
using namespace web::websockets::client;
using namespace std;

void main()
{
websocket_client client;
    client.connect(U("wss://sample.com/ws/")).then([](){ std::cout << "success" << std::endl; });

websocket_outgoing_message msg;
    msg.set_utf8_message("ch1");
    client.send(msg).then([](){ /* Successfully sent the message. */ }); //this string cause crush, why?

while (true) // can recieve 2 or less icoming mesages then crush, why?
{
    client.receive().then([](websocket_incoming_message msg) {
        return msg.extract_string();
    }).then([](std::string body) {
        std::cout << body << std::endl;
    });
}
}