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:
Vinnie Falco
2016-02-25 16:17:19 -05:00
parent 5e8d028da2
commit 2cb3834bbb
106 changed files with 14671 additions and 772 deletions

View File

@@ -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()
{