Reference: websocket_client_sync_ssl.cpp
// Read a message into our buffer
ws.read(buffer);
// Close the WebSocket connection
ws.close(websocket::close_code::normal);
Based on my test, the ws.close
will spit out a warning below:
ERROR message: short read (SSL routines, SSL routines), value: 335544539
Based on this post short read, this error can be safely ignored in the end of the session. I have tried the following method to suppress the warning:
try
{
boost::system::error_code close_ec;
ws.close(websocket::close_code::normal, close_ec);
if (close_ec)
{
std::cerr << "ERROR message: " << close_ec.message() << ", value: " << close_ec.value() << std::endl;
}
}
catch(...)
{
}
However, the ws.close
still prints out the warning message.
Question> Is there a way that I can suppress this message?
Are you sure? It looks like that's simply coming from the line:
So, you would check the value of
close_ec
and conditionally handle it: Short read error-Boost asio synchoronous https callAlso, note that some kinds of "short reads" can constitute security errors. Some of the samples have very insightful comments about this: