void MantidHTTP::OnMessage(connection_hdl hdl, WebSocketServer::message_ptr msg) { json js; try { js = json::parse(msg->get_payload()); std::cout << js.dump(4) << std::endl; } catch(std::invalid_argument&) { //Ignore malformed json return; } try { HandleMessage(hdl, js); } catch(std::exception& e) { std::cout << "Caught unhandled exception: " << e.what() << std::endl; } }
void WebSocketPort::on_message(websocketpp::connection_hdl HDL, websocketServer::message_ptr MSG) { lDebug("WS-R: " + MSG->get_payload()); this->received(HDL, MSG->get_payload()); }