roar
|
A WebsocketSession allows you to interact with a client via websocket protocol. More...
#include <websocket_session.hpp>
Classes | |
struct | Implementation |
Public Member Functions | |
WebsocketSession (std::variant< Detail::StreamType, boost::beast::ssl_stream< Detail::StreamType > > &&stream) | |
ROAR_PIMPL_SPECIAL_FUNCTIONS_NO_MOVE (WebsocketSession) | |
Detail::PromiseTypeBind< Detail::PromiseTypeBindThen<>, Detail::PromiseTypeBindFail< Error const & > > | accept (Request< boost::beast::http::empty_body > const &req) |
Accept an upgrade request and performs the necessary websocket handshake. | |
Public Member Functions inherited from Roar::Detail::SharedFromBase< WebsocketBase, WebsocketSession > | |
std::shared_ptr< WebsocketSession > | shared_from_this () |
Public Member Functions inherited from Roar::WebsocketBase | |
WebsocketBase (std::variant< Detail::StreamType, boost::beast::ssl_stream< Detail::StreamType > > &&stream) | |
WebsocketBase (std::variant< boost::beast::websocket::stream< boost::beast::ssl_stream< Detail::StreamType > >, boost::beast::websocket::stream< Detail::StreamType > > &&ws) | |
WebsocketBase (WebsocketBase &&)=delete | |
WebsocketBase & | operator= (WebsocketBase &&)=delete |
WebsocketBase (WebsocketBase const &)=delete | |
WebsocketBase & | operator= (WebsocketBase const &)=delete |
virtual | ~WebsocketBase () |
template<typename FunctionT > | |
auto | withStreamDo (FunctionT &&func) |
template<typename FunctionT > | |
auto | withStreamDo (FunctionT &&func) const |
void | readMessageMax (std::size_t amount) |
Set the maximum incoming message size option. | |
std::size_t | readMessageMax () const |
Returns the maximum incoming message size setting. | |
void | binary (bool enable) |
Enable/Disable binary for next send message. | |
bool | binary () const |
Returns true if the binary message write option is set. | |
Detail::PromiseTypeBind< Detail::PromiseTypeBindThen< std::size_t >, Detail::PromiseTypeBindFail< Error const & > > | send (std::string message) |
Sends a string to the server. | |
Detail::PromiseTypeBind< Detail::PromiseTypeBindThen< WebsocketReadResult >, Detail::PromiseTypeBindFail< Error const & > > | read () |
Reads something from the server. | |
Detail::PromiseTypeBind< Detail::PromiseTypeBindThen< WebsocketReadResult >, Detail::PromiseTypeBindFail< Error const & > > | read_some (std::size_t limit=4096) |
Reads something from the server. | |
void | autoFragment (bool enable) |
Set the automatic fragmentation option. | |
bool | autoFragment () const |
Returns true if the automatic fragmentation option is set. | |
bool | close (std::chrono::seconds closeWaitTimeout=std::chrono::seconds{3}) |
Closes the websocket connection. | |
Private Attributes | |
std::unique_ptr< Implementation > | impl_ |
Additional Inherited Members | |
Protected Attributes inherited from Roar::WebsocketBase | |
std::variant< boost::beast::websocket::stream< boost::beast::ssl_stream< Detail::StreamType > >, boost::beast::websocket::stream< Detail::StreamType > > | ws_ |
A WebsocketSession allows you to interact with a client via websocket protocol.
Roar::WebsocketSession::WebsocketSession | ( | std::variant< Detail::StreamType, boost::beast::ssl_stream< Detail::StreamType > > && | stream | ) |
Detail::PromiseTypeBind< Detail::PromiseTypeBindThen<>, Detail::PromiseTypeBindFail< Error const & > > Roar::WebsocketSession::accept | ( | Request< boost::beast::http::empty_body > const & | req | ) |
Accept an upgrade request and performs the necessary websocket handshake.
req | An http->ws upgrade request. |
Roar::WebsocketSession::ROAR_PIMPL_SPECIAL_FUNCTIONS_NO_MOVE | ( | WebsocketSession | ) |
|
private |