Skip to content

api/web.h

Namespaces

Name
cvedia
cvedia::rt
API for controlling the server and lifecycle management of runtime instances.
cvedia::rt::api
cvedia::rt::api::web

Functions

Name
void listen(std::string const & ip, int port, int keepAliveMaxCount =5, int keepAliveTimeout =5)
Start webserver for REST API.
void stopListen()
Shutdown REST API webserver.
std::string webclient_post(std::string url, std::string path, std::string payload)
Do a HTTP POST to an url.
std::string webclient_get(std::string url, std::string path)
Do a HTTP GET from an url.
void registerRestHandler(std::unique_ptr< RestApiBase > api)

Functions Documentation

function listen

void listen(
    std::string const & ip,
    int port,
    int keepAliveMaxCount =5,
    int keepAliveTimeout =5
)

Start webserver for REST API.

Parameters:

  • string $ip IP to listen on
  • number $port Port to listen on

function stopListen

void stopListen()

Shutdown REST API webserver.

function webclient_post

std::string webclient_post(
    std::string url,
    std::string path,
    std::string payload
)

Do a HTTP POST to an url.

Parameters:

  • string $ip IP to post to
  • string $path Url path to post to
  • string $payload Data to send

function webclient_get

std::string webclient_get(
    std::string url,
    std::string path
)

Do a HTTP GET from an url.

Parameters:

  • string $url url to get
  • string $path Url path to get from

function registerRestHandler

void registerRestHandler(
    std::unique_ptr< RestApiBase > api
)