mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Beast.WebSocket:
Beast.WebSocket provides developers with a robust WebSocket implementation built on Boost.Asio with a consistent asynchronous model using a modern C++ approach.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#define RIPPLE_SERVER_PLAINHTTPPEER_H_INCLUDED
|
||||
|
||||
#include <ripple/server/impl/BaseHTTPPeer.h>
|
||||
#include <ripple/server/impl/PlainWSPeer.h>
|
||||
#include <memory>
|
||||
|
||||
namespace ripple {
|
||||
@@ -44,12 +45,15 @@ public:
|
||||
void
|
||||
run();
|
||||
|
||||
std::shared_ptr<WSSession>
|
||||
websocketUpgrade() override;
|
||||
|
||||
private:
|
||||
void
|
||||
do_request();
|
||||
do_request() override;
|
||||
|
||||
void
|
||||
do_close();
|
||||
do_close() override;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -71,7 +75,7 @@ PlainHTTPPeer::PlainHTTPPeer (Port const& port, Handler& handler,
|
||||
}
|
||||
|
||||
void
|
||||
PlainHTTPPeer::run ()
|
||||
PlainHTTPPeer::run()
|
||||
{
|
||||
if (!handler_.onAccept (session(), remote_address_))
|
||||
{
|
||||
@@ -88,6 +92,17 @@ PlainHTTPPeer::run ()
|
||||
shared_from_this(), std::placeholders::_1));
|
||||
}
|
||||
|
||||
std::shared_ptr<WSSession>
|
||||
PlainHTTPPeer::websocketUpgrade()
|
||||
{
|
||||
auto ws = ios().emplace<PlainWSPeer>(
|
||||
port_, handler_, remote_address_,
|
||||
std::move(message_), std::move(stream_),
|
||||
journal_);
|
||||
ws->run();
|
||||
return ws;
|
||||
}
|
||||
|
||||
void
|
||||
PlainHTTPPeer::do_request()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user