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 final |
Returns whether the channel is listening. More... | |
size_t | size () const final |
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... | |
void | setPongTimeout (time::milliseconds timeout) |
void | handlePong (websocketpp::connection_hdl hdl) |
void | handlePongTimeout (websocketpp::connection_hdl hdl) |
Public Member Functions inherited from nfd::face::Channel | |
virtual | ~Channel () |
const FaceUri & | getUri () const |
size_t | getDefaultMtu () const |
Returns the default MTU for all faces created by this channel. More... | |
Public Attributes | |
NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE | __pad0__: void setPingInterval(time::milliseconds interval) |
Additional Inherited Members | |
Protected Member Functions inherited from nfd::face::Channel | |
void | setUri (const FaceUri &uri) |
void | setDefaultMtu (size_t mtu) |
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 37 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::getGlobalIoService(), handlePong(), handlePongTimeout(), NFD_LOG_CHAN_INFO, 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_handler(), and nfd::face::Channel::setUri().
|
inlinefinalvirtual |
Returns whether the channel is listening.
Implements nfd::face::Channel.
Definition at line 57 of file websocket-channel.hpp.
Referenced by listen().
|
inlinefinalvirtual |
Returns the number of faces in the channel.
Implements nfd::face::Channel.
Definition at line 63 of file websocket-channel.hpp.
References NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE.
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 151 of file websocket-channel.cpp.
References isListening(), NFD_LOG_CHAN_DEBUG, NFD_LOG_CHAN_WARN, and websocketpp::server< config >::start_accept().
void nfd::face::WebSocketChannel::setPongTimeout | ( | time::milliseconds | timeout | ) |
Definition at line 77 of file websocket-channel.cpp.
References websocketpp::endpoint< connection, config >::set_pong_timeout().
void nfd::face::WebSocketChannel::handlePong | ( | websocketpp::connection_hdl | hdl | ) |
Definition at line 97 of file websocket-channel.cpp.
References nfd::face::connectFaceClosedSignal(), websocketpp::endpoint< connection, config >::get_con_from_hdl(), nonstd::optional_lite::std11::move(), NFD_LOG_CHAN_TRACE, and NFD_LOG_CHAN_WARN.
Referenced by WebSocketChannel().
void nfd::face::WebSocketChannel::handlePongTimeout | ( | websocketpp::connection_hdl | hdl | ) |
Definition at line 85 of file websocket-channel.cpp.
References NFD_LOG_CHAN_WARN.
Referenced by WebSocketChannel().
NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE nfd::face::WebSocketChannel::__pad0__ |
Definition at line 81 of file websocket-channel.hpp.