Add WebSocket 04 interface.

* New WebSocket04 traits class implements strategies.
* New "websocket_version" configuration setting selects between 0.2 and 0.4.
This commit is contained in:
Tom Ritchford
2015-02-02 19:31:32 -05:00
parent e5b0b7e9a7
commit 9f64ad8d89
12 changed files with 782 additions and 10 deletions

View File

@@ -18,6 +18,7 @@
//==============================================================================
#include <BeastConfig.h>
#include <ripple/basics/BasicConfig.h>
#include <ripple/websocket/MakeServer.h>
#include <ripple/websocket/WebSocket.h>
@@ -26,13 +27,16 @@ namespace websocket {
std::unique_ptr<beast::Stoppable> makeServer (ServerDescription const& desc)
{
static std::string const version = "0.2";
auto version = get<std::string> (
desc.config["server"], "websocket_version");
if (version.empty())
version = WebSocket02::versionName();
WriteLog (lsWARNING, WebSocket) << "Websocket version " << version;
if (version == WebSocket02::versionName())
return makeServer02 (desc);
assert (false);
return {};
assert (version == "04");
return makeServer04 (desc);
}
} // websocket