bool WebSocketFramer::checkHandshakeResponse(http::Response& response) { assert(_mode == ws::ClientSide); assert(_headerState == 1); if (response.getStatus() == http::StatusCode::SwitchingProtocols) { // Complete handshake or throw completeHandshake(response); // Success _headerState++; assert(handshakeComplete()); return true; } else if (response.getStatus() == http::StatusCode::Unauthorized) assert(0 && "authentication not implemented"); else throw std::runtime_error("WebSocket error: Cannot upgrade to WebSocket connection: " + response.getReason()); //, ws::ErrorNoHandshake // Need to resend request return false; }