THRIFT-5185: Support for using WebSockets as a server transport
Client: cpp
diff --git a/test/cpp/src/TestServer.cpp b/test/cpp/src/TestServer.cpp
index 8fdab86..65317f8 100644
--- a/test/cpp/src/TestServer.cpp
+++ b/test/cpp/src/TestServer.cpp
@@ -39,6 +39,7 @@
#include <thrift/transport/TSSLSocket.h>
#include <thrift/transport/TServerSocket.h>
#include <thrift/transport/TTransportUtils.h>
+#include <thrift/transport/TWebSocketServer.h>
#include <thrift/transport/TZlibTransport.h>
#include "SecondService.h"
@@ -588,7 +589,7 @@
("domain-socket", po::value<string>(&domain_socket) ->default_value(domain_socket), "Unix Domain Socket (e.g. /tmp/ThriftTest.thrift)")
("abstract-namespace", "Create the domain socket in the Abstract Namespace (no connection with filesystem pathnames)")
("server-type", po::value<string>(&server_type)->default_value(server_type), "type of server, \"simple\", \"thread-pool\", \"threaded\", or \"nonblocking\"")
- ("transport", po::value<string>(&transport_type)->default_value(transport_type), "transport: buffered, framed, http, zlib")
+ ("transport", po::value<string>(&transport_type)->default_value(transport_type), "transport: buffered, framed, http, websocket, zlib")
("protocol", po::value<string>(&protocol_type)->default_value(protocol_type), "protocol: binary, compact, header, json, multi, multic, multih, multij")
("ssl", "Encrypted Transport using SSL")
("zlib", "Wrapped Transport using Zlib")
@@ -635,6 +636,7 @@
if (transport_type == "buffered") {
} else if (transport_type == "framed") {
} else if (transport_type == "http") {
+ } else if (transport_type == "websocket") {
} else if (transport_type == "zlib") {
// crosstester will pass zlib as a flag and a transport right now...
} else {
@@ -728,6 +730,12 @@
if (transport_type == "http" && server_type != "nonblocking") {
transportFactory = std::make_shared<THttpServerTransportFactory>();
+ } else if (transport_type == "websocket" && server_type != "nonblocking") {
+ if (protocol_type == "json" || protocol_type == "multij") {
+ transportFactory = std::make_shared<TTextWebSocketServerTransportFactory>();
+ } else {
+ transportFactory = std::make_shared<TBinaryWebSocketServerTransportFactory>();
+ }
} else if (transport_type == "framed") {
transportFactory = std::make_shared<TFramedTransportFactory>();
} else {