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

New Post: Example for websocket_client->send() catching its exception if connection is closed.

$
0
0
Hi hermannf,

You can either do:
ws->send(msg).then([] (pplx::task<void> t)
{
    try
    {
        t.get();
    }
    catch (websocket_exception e)
    {
         /* .... */
    }
});
or (if this is your synchronization point)
try
{
    ws->send(msg).get();
}
catch (...)
{
    /* ... */
}
Sincerely,
roschuma

Viewing all articles
Browse latest Browse all 4845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>