rippled
Loading...
Searching...
No Matches
PlainWSPeer.h
1#ifndef XRPL_SERVER_PLAINWSPEER_H_INCLUDED
2#define XRPL_SERVER_PLAINWSPEER_H_INCLUDED
3
4#include <xrpl/server/detail/BaseWSPeer.h>
5
6#include <boost/beast/core/tcp_stream.hpp>
7
8#include <memory>
9
10namespace ripple {
11
12template <class Handler>
13class PlainWSPeer : public BaseWSPeer<Handler, PlainWSPeer<Handler>>,
14 public std::enable_shared_from_this<PlainWSPeer<Handler>>
15{
16 friend class BasePeer<Handler, PlainWSPeer>;
17 friend class BaseWSPeer<Handler, PlainWSPeer>;
18
20 using error_code = boost::system::error_code;
21 using endpoint_type = boost::asio::ip::tcp::endpoint;
22 using waitable_timer = boost::asio::basic_waitable_timer<clock_type>;
23 using socket_type = boost::beast::tcp_stream;
24
25 boost::beast::websocket::stream<socket_type> ws_;
26
27public:
28 template <class Body, class Headers>
30 Port const& port,
31 Handler& handler,
32 endpoint_type remote_address,
33 boost::beast::http::request<Body, Headers>&& request,
34 socket_type&& socket,
35 beast::Journal journal);
36};
37
38//------------------------------------------------------------------------------
39
40template <class Handler>
41template <class Body, class Headers>
43 Port const& port,
44 Handler& handler,
45 endpoint_type remote_address,
46 boost::beast::http::request<Body, Headers>&& request,
47 socket_type&& socket,
48 beast::Journal journal)
49 : BaseWSPeer<Handler, PlainWSPeer>(
50 port,
51 handler,
52 socket.get_executor(),
53 waitable_timer{socket.get_executor()},
54 remote_address,
55 std::move(request),
56 journal)
57 , ws_(std::move(socket))
58{
59}
60
61} // namespace ripple
62
63#endif
A generic endpoint for log messages.
Definition Journal.h:41
Represents an active WebSocket connection.
Definition BaseWSPeer.h:27
http_request_type const & request() const override
Definition BaseWSPeer.h:81
boost::asio::basic_waitable_timer< clock_type > waitable_timer
Definition PlainWSPeer.h:22
boost::beast::websocket::stream< socket_type > ws_
Definition PlainWSPeer.h:25
PlainWSPeer(Port const &port, Handler &handler, endpoint_type remote_address, boost::beast::http::request< Body, Headers > &&request, socket_type &&socket, beast::Journal journal)
Definition PlainWSPeer.h:42
boost::asio::ip::tcp::endpoint endpoint_type
Definition PlainWSPeer.h:21
boost::system::error_code error_code
Definition PlainWSPeer.h:20
boost::beast::tcp_stream socket_type
Definition PlainWSPeer.h:23
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
STL namespace.
Configuration information for a Server listening port.
Definition Port.h:31