raccoon::web::Session class
#include <session.hpp>

Class to manage web requests.

Public types

enum Status { STATUS_OK = 0, STATUS_GRACEFUL_SHUTDOWN, STATUS_FORCED_SHUTDOWN }

Constructors, destructors, conversion operators

Session(uv_loop_t* event_loop = uv_default_loop()) explicit

Public functions

auto run() -> Status noexcept
auto ws(const std::string& url, WebSocketConnection::callback on_data) -> std::shared_ptr<WebSocketConnection>
auto connections() const noexcept
auto status() const noexcept

Friends

auto detail::get_handle(Session* session) -> CURLM*
void detail::process_libcurl_messages(Session* session, int running_handles)

Enum documentation

enum raccoon::web::Session::Status

Status of the request session.

Function documentation

raccoon::web::Session::Session(uv_loop_t* event_loop = uv_default_loop()) explicit

Create a new session.

Status raccoon::web::Session::run() noexcept

Returns Status The status of the session upon termination.

Run the session to completion.

Return value should be checked and the application should exit if a GRACEFUL_SHUTDOWN or FORCED_SHUTDOWN status are received.

std::shared_ptr<WebSocketConnection> raccoon::web::Session::ws(const std::string& url, WebSocketConnection::callback on_data)

Parameters
url The url to open a connection to.
on_data
Returns std::shared_ptr<WebSocketConnection> The web socket connection.

Open a WebSocket connection.

auto raccoon::web::Session::connections() const noexcept

Returns std::vector<std::shared_ptr<WebSocketConnection>>

Get all initialized connections.

auto raccoon::web::Session::status() const noexcept

Returns Status The current session status.

Get the status of the session.