roar
Loading...
Searching...
No Matches
websocket_session.hpp
Go to the documentation of this file.
1#pragma once
2
7
8#include <boost/beast/http/empty_body.hpp>
9#include <boost/beast/ssl/ssl_stream.hpp>
10#include <boost/beast/core/tcp_stream.hpp>
11#include <promise-cpp/promise.hpp>
12
13#include <memory>
14#include <variant>
15
16namespace Roar
17{
18 template <typename>
19 class Request;
20
24 class WebsocketSession : public Detail::SharedFromBase<WebsocketBase, WebsocketSession>
25 {
26 public:
27 WebsocketSession(std::variant<Detail::StreamType, boost::beast::ssl_stream<Detail::StreamType>>&& stream);
29
37
38 private:
39 struct Implementation;
40 std::unique_ptr<Implementation> impl_;
41 };
42}
This class extends the boost::beast::http::request<BodyT> with additional convenience.
Definition request.hpp:52
A WebsocketSession allows you to interact with a client via websocket protocol.
Definition websocket_session.hpp:25
std::unique_ptr< Implementation > impl_
Definition websocket_session.hpp:40
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.
Definition websocket_session.cpp:31
ROAR_PIMPL_SPECIAL_FUNCTIONS_NO_MOVE(WebsocketSession)
boost::beast::basic_stream< boost::asio::ip::tcp, boost::asio::any_io_executor, boost::beast::simple_rate_policy > StreamType
Definition stream_type.hpp:11
Definition authorization.hpp:10
Definition promise_compat.hpp:67
Definition promise_compat.hpp:70
Definition shared_from_base.hpp:9
Definition websocket_session.cpp:15