NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
telemetry_server Class Reference

The telemetry server accepts connections and sends a message every second to each client containing an integer count. More...

Public Types

typedef websocketpp::connection_hdl connection_hdl
 
typedef websocketpp::server< websocketpp::config::asioserver
 

Public Member Functions

 telemetry_server ()
 
void run (std::string docroot, uint16_t port)
 
void set_timer ()
 
void on_timer (websocketpp::lib::error_code const &ec)
 
void on_http (connection_hdl hdl)
 
void on_open (connection_hdl hdl)
 
void on_close (connection_hdl hdl)
 

Detailed Description

The telemetry server accepts connections and sends a message every second to each client containing an integer count.

This example can be used as the basis for programs that expose a stream of telemetry data for logging, dashboards, etc.

This example uses the timer based concurrency method and is self contained and singled threaded. Refer to telemetry client for an example of a similar telemetry setup using threads rather than timers.

This example also includes an example simple HTTP server that serves a web dashboard displaying the count. This simple design is suitable for use delivering a small number of files to a small number of clients. It is ideal for cases like embedded dashboards that don't want the complexity of an extra HTTP server to serve static files.

This design will fall over under high traffic or DoS conditions. In such cases you are much better off proxying to a real HTTP server for the http requests.

Definition at line 31 of file telemetry_server.cpp.

Member Typedef Documentation

◆ connection_hdl

◆ server

Constructor & Destructor Documentation

◆ telemetry_server()

Member Function Documentation

◆ run()

void telemetry_server::run ( std::string  docroot,
uint16_t  port 
)
inline

◆ set_timer()

void telemetry_server::set_timer ( )
inline

Definition at line 77 of file telemetry_server.cpp.

References on_timer().

Referenced by on_timer(), and run().

◆ on_timer()

void telemetry_server::on_timer ( websocketpp::lib::error_code const &  ec)
inline

◆ on_http()

◆ on_open()

void telemetry_server::on_open ( connection_hdl  hdl)
inline

Definition at line 156 of file telemetry_server.cpp.

Referenced by telemetry_server().

◆ on_close()

void telemetry_server::on_close ( connection_hdl  hdl)
inline

Definition at line 160 of file telemetry_server.cpp.

Referenced by telemetry_server().


The documentation for this class was generated from the following file: