RESTinio

Public Member Functions | Private Attributes | Friends | List of all members
restinio::websocket::basic::ws_t Class Reference

A WebSocket bind. More...

`#include <websocket.hpp>`

Inheritance diagram for restinio::websocket::basic::ws_t:

## Public Member Functions
| ws_t (const ws_t &)=delete
| ws_t (ws_t &&)=delete
ws_t & | operator= (const ws_t &)=delete
ws_t & | operator= (ws_t &&)=delete
| ws_t (impl::ws_connection_handle_t ws_connection_handle, endpoint_t remote_endpoint)
| ~ws_t ()
connection_id_t | connection_id () const
| Get connection id. More...
void | shutdown ()
| Shutdown websocket: wait for all outgoing data to be sent, and close connection. More...
void | kill ()
| Kill websocket: close underlying tcp socket. Do not tolerate unsent outgoing data. More...
void | send_message (final_frame_flag_t final_flag, opcode_t opcode, writable_item_t payload, write_status_cb_t wscb=write_status_cb_t{})
| Send_websocket message. More...
void | send_message (message_t msg, write_status_cb_t wscb=write_status_cb_t{})
const endpoint_t & | remote_endpoint () const noexcept
| Get the remote endpoint of the underlying connection. More...

## Private Attributes
impl::ws_connection_handle_t | m_ws_connection_handle
const endpoint_t | m_remote_endpoint
| Remote endpoint for this ws-connection. More...

## Friends
void | activate (ws_t &ws)
| Activate websocket: start receiving messages. More...

## Detailed Description

A WebSocket bind.

An abstraction for websocket. User have to keep this handle during all the period that websocket is used. It must be stored in a `shared_ptr<ws_t>` (ws_handle_t) and when the last reference on this handle is lost underlying connection will be closed.

Definition at line 38 of file websocket.hpp.

## Constructor & Destructor Documentation

## ◆ ws_t() [1/3]

restinio::websocket::basic::ws_t::ws_t | ( | const ws_t & |  | ) |
| delete

## ◆ ws_t() [2/3]

restinio::websocket::basic::ws_t::ws_t | ( | ws_t && |  | ) |
| delete

## ◆ ws_t() [3/3]

restinio::websocket::basic::ws_t::ws_t | ( | impl::ws_connection_handle_t | ws_connection_handle,
|  | endpoint_t | remote_endpoint
| ) |  |
| inline

Definition at line 57 of file websocket.hpp.

## ◆ ~ws_t()

restinio::websocket::basic::ws_t::~ws_t | ( |  | ) |
| inline

Definition at line 64 of file websocket.hpp.

## Member Function Documentation

## ◆ connection_id()

connection_id_t restinio::websocket::basic::ws_t::connection_id | ( |  | ) | const
| inline

Get connection id.

If connection exists then its id is returned, otherwise retursn zero.

Definition at line 80 of file websocket.hpp.

## ◆ kill()

void restinio::websocket::basic::ws_t::kill | ( |  | ) |
| inline

Kill websocket: close underlying tcp socket. Do not tolerate unsent outgoing data.

Definition at line 100 of file websocket.hpp.

## ◆ operator=() [1/2]

ws_t & restinio::websocket::basic::ws_t::operator= | ( | const ws_t & |  | ) |
| delete

## ◆ operator=() [2/2]

ws_t & restinio::websocket::basic::ws_t::operator= | ( | ws_t && |  | ) |
| delete

## ◆ remote_endpoint()

const endpoint_t & restinio::websocket::basic::ws_t::remote_endpoint | ( |  | ) | const
| inline noexcept

Get the remote endpoint of the underlying connection.

Definition at line 181 of file websocket.hpp.

## ◆ send_message() [1/2]

void restinio::websocket::basic::ws_t::send_message | ( | final_frame_flag_t | final_flag,
|  | opcode_t | opcode,
|  | writable_item_t | payload,
|  | write_status_cb_t | wscb = `write_status_cb_t{}`
| ) |  |
| inline

Send_websocket message.

Definition at line 111 of file websocket.hpp.

## ◆ send_message() [2/2]

void restinio::websocket::basic::ws_t::send_message | ( | message_t | msg,
|  | write_status_cb_t | wscb = `write_status_cb_t{}`
| ) |  |
| inline

Definition at line 171 of file websocket.hpp.

## ◆ shutdown()

void restinio::websocket::basic::ws_t::shutdown | ( |  | ) |
| inline

Shutdown websocket: wait for all outgoing data to be sent, and close connection.

Definition at line 88 of file websocket.hpp.

## Friends And Related Function Documentation

## ◆ activate

void activate | ( | ws_t & | ws | ) |
| friend

Activate websocket: start receiving messages.

Definition at line 47 of file websocket.hpp.

## Member Data Documentation

## ◆ m_remote_endpoint

const endpoint_t restinio::websocket::basic::ws_t::m_remote_endpoint
| private

Remote endpoint for this ws-connection.

Definition at line 187 of file websocket.hpp.

## ◆ m_ws_connection_handle

impl::ws_connection_handle_t restinio::websocket::basic::ws_t::m_ws_connection_handle
| private

Definition at line 184 of file websocket.hpp.

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

- restinio/websocket/websocket.hpp