void WebSocketTransport::processErrorCode(const websocketpp::lib::error_code& error) { NFD_LOG_FACE_TRACE(__func__); if (getState() == TransportState::CLOSING || getState() == TransportState::FAILED || getState() == TransportState::CLOSED) // transport is shutting down, ignore any errors return; NFD_LOG_FACE_WARN("Send or ping operation failed: " << error.message()); this->setState(TransportState::FAILED); doClose(); }
void on_timer(websocketpp::lib::error_code const & ec) { if (ec) { // there was an error, stop telemetry m_endpoint.get_alog().write(websocketpp::log::alevel::app, "Timer Error: "+ec.message()); return; } std::stringstream val; val << "count is " << m_count++; // Broadcast count to all connections con_list::iterator it; for (it = m_connections.begin(); it != m_connections.end(); ++it) { m_endpoint.send(*it,val.str(),websocketpp::frame::opcode::text); } // set timer for next telemetry check set_timer(); }