Class implementing WebSocket-based channel to create faces. More...
#include <websocket-channel.hpp>
Public Member Functions | |
WebSocketChannel (const websocket::Endpoint &localEndpoint) | |
Create WebSocket channel for the local endpoint. More... | |
bool | isListening () const override |
Returns whether the channel is listening. More... | |
size_t | size () const override |
Returns the number of faces in the channel. More... | |
void | listen (const FaceCreatedCallback &onFaceCreated) |
Enable listening on the local endpoint, accept connections, and create faces when remote host makes a connection. More... | |
Public Member Functions inherited from nfd::face::Channel | |
virtual | ~Channel () |
const FaceUri & | getUri () const |
Additional Inherited Members | |
Protected Member Functions inherited from nfd::face::Channel | |
void | setUri (const FaceUri &uri) |
Class implementing WebSocket-based channel to create faces.
Definition at line 43 of file websocket-channel.hpp.
|
explicit |
Create WebSocket channel for the local endpoint.
To enable creation of faces upon incoming connections, one needs to explicitly call WebSocketChannel::listen method. The created channel is bound to the localEndpoint.
Definition at line 36 of file websocket-channel.cpp.
References websocketpp::log::elevel::all, websocketpp::log::alevel::all, websocketpp::endpoint< connection, config >::clear_access_channels(), websocketpp::endpoint< connection, config >::clear_error_channels(), nfd::face::connectFaceClosedSignal(), websocketpp::endpoint< connection, config >::get_con_from_hdl(), nfd::getGlobalIoService(), websocketpp::transport::asio::endpoint< config >::init_asio(), websocketpp::transport::asio::endpoint< config >::is_listening(), websocketpp::lib::asio::milliseconds(), NFD_LOG_CHAN_INFO, NFD_LOG_CHAN_TRACE, NFD_LOG_CHAN_WARN, websocketpp::endpoint< connection, config >::set_close_handler(), websocketpp::endpoint< connection, config >::set_message_handler(), websocketpp::endpoint< connection, config >::set_open_handler(), websocketpp::endpoint< connection, config >::set_pong_handler(), websocketpp::endpoint< connection, config >::set_pong_timeout(), websocketpp::endpoint< connection, config >::set_pong_timeout_handler(), websocketpp::transport::asio::endpoint< config >::set_reuse_addr(), nfd::face::Channel::setUri(), and websocketpp::transport::error::timeout.
|
inlineoverridevirtual |
Returns whether the channel is listening.
Implements nfd::face::Channel.
Definition at line 57 of file websocket-channel.hpp.
Referenced by listen().
|
inlineoverridevirtual |
Returns the number of faces in the channel.
Implements nfd::face::Channel.
Definition at line 63 of file websocket-channel.hpp.
References websocketpp::lib::asio::milliseconds(), PUBLIC_WITH_TESTS_ELSE_PRIVATE, and websocketpp::transport::error::timeout.
void nfd::face::WebSocketChannel::listen | ( | const FaceCreatedCallback & | onFaceCreated | ) |
Enable listening on the local endpoint, accept connections, and create faces when remote host makes a connection.
onFaceCreated | Callback to notify successful creation of a face |
Definition at line 143 of file websocket-channel.cpp.
References isListening(), websocketpp::transport::asio::endpoint< config >::listen(), NFD_LOG_CHAN_DEBUG, NFD_LOG_CHAN_WARN, and websocketpp::server< config >::start_accept().