Isolate WebSocket 0.2-specific code.

* Hide implementation details of the WebSocket server from clients.
* Extract a generic traits class.
This commit is contained in:
Tom Ritchford
2015-01-22 16:48:58 -05:00
parent b357390215
commit 9c3522cb70
14 changed files with 775 additions and 479 deletions

View File

@@ -17,34 +17,33 @@
*/
//==============================================================================
#ifndef RIPPLE_APP_WEBSOCKET_WSDOOR_H_INCLUDED
#define RIPPLE_APP_WEBSOCKET_WSDOOR_H_INCLUDED
#ifndef RIPPLED_RIPPLE_WEBSOCKET_MAKESERVER_H
#define RIPPLED_RIPPLE_WEBSOCKET_MAKESERVER_H
#include <ripple/app/main/CollectorManager.h>
#include <ripple/net/InfoSub.h>
#include <ripple/resource/Manager.h>
#include <ripple/server/Port.h>
#include <beast/threads/Stoppable.h>
namespace beast { class Stoppable; }
namespace ripple {
/** Handles accepting incoming WebSocket connections. */
class WSDoor : public beast::Stoppable
namespace Resource { class Manager; }
namespace websocket {
struct ServerDescription
{
protected:
explicit WSDoor (Stoppable& parent);
public:
virtual ~WSDoor() = default;
// VFALCO TODO Add this member function to prevent races on shutdown
//virtual void close() = 0;
HTTP::Port port;
Resource::Manager& resourceManager;
InfoSub::Source& source;
beast::Journal& journal;
CollectorManager& collectorManager;
};
std::unique_ptr<WSDoor>
make_WSDoor (HTTP::Port const& port, Resource::Manager& resourceManager,
InfoSub::Source& source, CollectorManager& cm);
std::unique_ptr<beast::Stoppable> makeServer (ServerDescription const&);
}
} // websocket
} // ripple
#endif