Plotly.cpp 0.1.0
A C++ plotting library for expressive, interactive, real-time & streaming data visualization
Loading...
Searching...
No Matches
plotly::detail::HttpServer Class Reference

#include <http_server.hpp>

Public Member Functions

 HttpServer (const std::filesystem::path &directory)
 Construct a server serving files from a directory.
 ~HttpServer ()
 Destructor.
 HttpServer (const HttpServer &)=delete
auto operator= (const HttpServer &) -> HttpServer &=delete
 HttpServer (HttpServer &&)=delete
auto operator= (HttpServer &&) -> HttpServer &=delete
void start ()
 Start the HTTP server.
auto getPort () const noexcept -> int
 Get the port number the server is running on.
void setWebsocketPortRequestHandler (int wsPort)
 Configure the server to respond with a specific WebSocket port.
void stop ()
 Stop the HTTP server.

Constructor & Destructor Documentation

◆ HttpServer() [1/3]

plotly::detail::HttpServer::HttpServer ( const std::filesystem::path & directory)
explicit

Construct a server serving files from a directory.

Parameters
directoryPath to the directory containing files to serve

◆ ~HttpServer()

plotly::detail::HttpServer::~HttpServer ( )

Destructor.

◆ HttpServer() [2/3]

plotly::detail::HttpServer::HttpServer ( const HttpServer & )
delete

◆ HttpServer() [3/3]

plotly::detail::HttpServer::HttpServer ( HttpServer && )
delete

Member Function Documentation

◆ getPort()

auto plotly::detail::HttpServer::getPort ( ) const -> int
nodiscardnoexcept

Get the port number the server is running on.

Returns
The port number

◆ operator=() [1/2]

auto plotly::detail::HttpServer::operator= ( const HttpServer & ) -> HttpServer &=delete
delete

◆ operator=() [2/2]

auto plotly::detail::HttpServer::operator= ( HttpServer && ) -> HttpServer &=delete
delete

◆ setWebsocketPortRequestHandler()

void plotly::detail::HttpServer::setWebsocketPortRequestHandler ( int wsPort)

Configure the server to respond with a specific WebSocket port.

Parameters
wsPortThe WebSocket port to report

Sets up an endpoint that responds to WebSocket port requests with the specified port number. This is used for WebSocket communication between the browser and the application.

◆ start()

void plotly::detail::HttpServer::start ( )

Start the HTTP server.

This method starts the HTTP server on a randomly allocated port. The server runs in a background thread.

◆ stop()

void plotly::detail::HttpServer::stop ( )

Stop the HTTP server.

This method stops the HTTP server and joins the server thread.


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