most ws command take tls options, no-op for now (contributed by Matt DeBoer)
This commit is contained in:
parent
b3784b4c60
commit
4de7cb191b
44
ws/ws.cpp
44
ws/ws.cpp
@ -63,6 +63,8 @@ int main(int argc, char** argv)
|
|||||||
std::string redisHosts("127.0.0.1");
|
std::string redisHosts("127.0.0.1");
|
||||||
std::string redisPassword;
|
std::string redisPassword;
|
||||||
std::string appsConfigPath("appsConfig.json");
|
std::string appsConfigPath("appsConfig.json");
|
||||||
|
ix::SocketTLSOptions tlsOptions;
|
||||||
|
std::string ciphers;
|
||||||
std::string redirectUrl;
|
std::string redirectUrl;
|
||||||
bool headersOnly = false;
|
bool headersOnly = false;
|
||||||
bool followRedirects = false;
|
bool followRedirects = false;
|
||||||
@ -88,12 +90,26 @@ int main(int argc, char** argv)
|
|||||||
int jobs = 4;
|
int jobs = 4;
|
||||||
uint32_t maxWaitBetweenReconnectionRetries;
|
uint32_t maxWaitBetweenReconnectionRetries;
|
||||||
|
|
||||||
|
auto addTLSOptions = [&tlsOptions](CLI::App* app) {
|
||||||
|
app->add_option(
|
||||||
|
"--cert-file", tlsOptions.certFile, "Path to the (PEM format) TLS cert file")
|
||||||
|
->check(CLI::ExistingPath);
|
||||||
|
app->add_option("--key-file", tlsOptions.keyFile, "Path to the (PEM format) TLS key file")
|
||||||
|
->check(CLI::ExistingPath);
|
||||||
|
app->add_option("--ca-file", tlsOptions.caFile, "Path to the (PEM format) ca roots file")
|
||||||
|
->check(CLI::ExistingPath);
|
||||||
|
app->add_option("--ciphers",
|
||||||
|
tlsOptions.ciphers,
|
||||||
|
"A (comma/space/colon) separated list of ciphers to use for TLS");
|
||||||
|
};
|
||||||
|
|
||||||
CLI::App* sendApp = app.add_subcommand("send", "Send a file");
|
CLI::App* sendApp = app.add_subcommand("send", "Send a file");
|
||||||
sendApp->add_option("url", url, "Connection url")->required();
|
sendApp->add_option("url", url, "Connection url")->required();
|
||||||
sendApp->add_option("path", path, "Path to the file to send")
|
sendApp->add_option("path", path, "Path to the file to send")
|
||||||
->required()
|
->required()
|
||||||
->check(CLI::ExistingPath);
|
->check(CLI::ExistingPath);
|
||||||
sendApp->add_option("--pidfile", pidfile, "Pid file");
|
sendApp->add_option("--pidfile", pidfile, "Pid file");
|
||||||
|
addTLSOptions(sendApp);
|
||||||
|
|
||||||
CLI::App* receiveApp = app.add_subcommand("receive", "Receive a file");
|
CLI::App* receiveApp = app.add_subcommand("receive", "Receive a file");
|
||||||
receiveApp->add_option("url", url, "Connection url")->required();
|
receiveApp->add_option("url", url, "Connection url")->required();
|
||||||
@ -102,11 +118,13 @@ int main(int argc, char** argv)
|
|||||||
"Delay (ms) to wait after receiving a fragment"
|
"Delay (ms) to wait after receiving a fragment"
|
||||||
" to artificially slow down the receiver");
|
" to artificially slow down the receiver");
|
||||||
receiveApp->add_option("--pidfile", pidfile, "Pid file");
|
receiveApp->add_option("--pidfile", pidfile, "Pid file");
|
||||||
|
addTLSOptions(receiveApp);
|
||||||
|
|
||||||
CLI::App* transferApp = app.add_subcommand("transfer", "Broadcasting server");
|
CLI::App* transferApp = app.add_subcommand("transfer", "Broadcasting server");
|
||||||
transferApp->add_option("--port", port, "Connection url");
|
transferApp->add_option("--port", port, "Connection url");
|
||||||
transferApp->add_option("--host", hostname, "Hostname");
|
transferApp->add_option("--host", hostname, "Hostname");
|
||||||
transferApp->add_option("--pidfile", pidfile, "Pid file");
|
transferApp->add_option("--pidfile", pidfile, "Pid file");
|
||||||
|
addTLSOptions(transferApp);
|
||||||
|
|
||||||
CLI::App* connectApp = app.add_subcommand("connect", "Connect to a remote server");
|
CLI::App* connectApp = app.add_subcommand("connect", "Connect to a remote server");
|
||||||
connectApp->add_option("url", url, "Connection url")->required();
|
connectApp->add_option("url", url, "Connection url")->required();
|
||||||
@ -117,6 +135,7 @@ int main(int argc, char** argv)
|
|||||||
connectApp->add_option("--max_wait",
|
connectApp->add_option("--max_wait",
|
||||||
maxWaitBetweenReconnectionRetries,
|
maxWaitBetweenReconnectionRetries,
|
||||||
"Max Wait Time between reconnection retries");
|
"Max Wait Time between reconnection retries");
|
||||||
|
addTLSOptions(connectApp);
|
||||||
|
|
||||||
CLI::App* chatApp = app.add_subcommand("chat", "Group chat");
|
CLI::App* chatApp = app.add_subcommand("chat", "Group chat");
|
||||||
chatApp->add_option("url", url, "Connection url")->required();
|
chatApp->add_option("url", url, "Connection url")->required();
|
||||||
@ -126,13 +145,16 @@ int main(int argc, char** argv)
|
|||||||
echoServerApp->add_option("--port", port, "Port");
|
echoServerApp->add_option("--port", port, "Port");
|
||||||
echoServerApp->add_option("--host", hostname, "Hostname");
|
echoServerApp->add_option("--host", hostname, "Hostname");
|
||||||
echoServerApp->add_flag("-g", greetings, "Verbose");
|
echoServerApp->add_flag("-g", greetings, "Verbose");
|
||||||
|
addTLSOptions(echoServerApp);
|
||||||
|
|
||||||
CLI::App* broadcastServerApp = app.add_subcommand("broadcast_server", "Broadcasting server");
|
CLI::App* broadcastServerApp = app.add_subcommand("broadcast_server", "Broadcasting server");
|
||||||
broadcastServerApp->add_option("--port", port, "Port");
|
broadcastServerApp->add_option("--port", port, "Port");
|
||||||
broadcastServerApp->add_option("--host", hostname, "Hostname");
|
broadcastServerApp->add_option("--host", hostname, "Hostname");
|
||||||
|
addTLSOptions(broadcastServerApp);
|
||||||
|
|
||||||
CLI::App* pingPongApp = app.add_subcommand("ping", "Ping pong");
|
CLI::App* pingPongApp = app.add_subcommand("ping", "Ping pong");
|
||||||
pingPongApp->add_option("url", url, "Connection url")->required();
|
pingPongApp->add_option("url", url, "Connection url")->required();
|
||||||
|
addTLSOptions(pingPongApp);
|
||||||
|
|
||||||
CLI::App* httpClientApp = app.add_subcommand("curl", "HTTP Client");
|
CLI::App* httpClientApp = app.add_subcommand("curl", "HTTP Client");
|
||||||
httpClientApp->add_option("url", url, "Connection url")->required();
|
httpClientApp->add_option("url", url, "Connection url")->required();
|
||||||
@ -148,6 +170,7 @@ int main(int argc, char** argv)
|
|||||||
httpClientApp->add_flag("--compress", compress, "Enable gzip compression");
|
httpClientApp->add_flag("--compress", compress, "Enable gzip compression");
|
||||||
httpClientApp->add_option("--connect-timeout", connectTimeOut, "Connection timeout");
|
httpClientApp->add_option("--connect-timeout", connectTimeOut, "Connection timeout");
|
||||||
httpClientApp->add_option("--transfer-timeout", transferTimeout, "Transfer timeout");
|
httpClientApp->add_option("--transfer-timeout", transferTimeout, "Transfer timeout");
|
||||||
|
addTLSOptions(httpClientApp);
|
||||||
|
|
||||||
CLI::App* redisPublishApp = app.add_subcommand("redis_publish", "Redis publisher");
|
CLI::App* redisPublishApp = app.add_subcommand("redis_publish", "Redis publisher");
|
||||||
redisPublishApp->add_option("--port", redisPort, "Port");
|
redisPublishApp->add_option("--port", redisPort, "Port");
|
||||||
@ -242,6 +265,7 @@ int main(int argc, char** argv)
|
|||||||
httpServerApp->add_option("--host", hostname, "Hostname");
|
httpServerApp->add_option("--host", hostname, "Hostname");
|
||||||
httpServerApp->add_flag("-L", redirect, "Redirect all request to redirect_url");
|
httpServerApp->add_flag("-L", redirect, "Redirect all request to redirect_url");
|
||||||
httpServerApp->add_option("--redirect_url", redirectUrl, "Url to redirect to");
|
httpServerApp->add_option("--redirect_url", redirectUrl, "Url to redirect to");
|
||||||
|
addTLSOptions(httpServerApp);
|
||||||
|
|
||||||
CLI::App* autobahnApp = app.add_subcommand("autobahn", "Test client Autobahn compliance");
|
CLI::App* autobahnApp = app.add_subcommand("autobahn", "Test client Autobahn compliance");
|
||||||
autobahnApp->add_option("--url", url, "url");
|
autobahnApp->add_option("--url", url, "url");
|
||||||
@ -267,16 +291,16 @@ int main(int argc, char** argv)
|
|||||||
int ret = 1;
|
int ret = 1;
|
||||||
if (app.got_subcommand("transfer"))
|
if (app.got_subcommand("transfer"))
|
||||||
{
|
{
|
||||||
ret = ix::ws_transfer_main(port, hostname);
|
ret = ix::ws_transfer_main(port, hostname, tlsOptions);
|
||||||
}
|
}
|
||||||
else if (app.got_subcommand("send"))
|
else if (app.got_subcommand("send"))
|
||||||
{
|
{
|
||||||
ret = ix::ws_send_main(url, path);
|
ret = ix::ws_send_main(url, path, tlsOptions);
|
||||||
}
|
}
|
||||||
else if (app.got_subcommand("receive"))
|
else if (app.got_subcommand("receive"))
|
||||||
{
|
{
|
||||||
bool enablePerMessageDeflate = false;
|
bool enablePerMessageDeflate = false;
|
||||||
ret = ix::ws_receive_main(url, enablePerMessageDeflate, delayMs);
|
ret = ix::ws_receive_main(url, enablePerMessageDeflate, delayMs, tlsOptions);
|
||||||
}
|
}
|
||||||
else if (app.got_subcommand("connect"))
|
else if (app.got_subcommand("connect"))
|
||||||
{
|
{
|
||||||
@ -285,7 +309,8 @@ int main(int argc, char** argv)
|
|||||||
disableAutomaticReconnection,
|
disableAutomaticReconnection,
|
||||||
disablePerMessageDeflate,
|
disablePerMessageDeflate,
|
||||||
binaryMode,
|
binaryMode,
|
||||||
maxWaitBetweenReconnectionRetries);
|
maxWaitBetweenReconnectionRetries,
|
||||||
|
tlsOptions);
|
||||||
}
|
}
|
||||||
else if (app.got_subcommand("chat"))
|
else if (app.got_subcommand("chat"))
|
||||||
{
|
{
|
||||||
@ -293,15 +318,15 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
else if (app.got_subcommand("echo_server"))
|
else if (app.got_subcommand("echo_server"))
|
||||||
{
|
{
|
||||||
ret = ix::ws_echo_server_main(port, greetings, hostname);
|
ret = ix::ws_echo_server_main(port, greetings, hostname, tlsOptions);
|
||||||
}
|
}
|
||||||
else if (app.got_subcommand("broadcast_server"))
|
else if (app.got_subcommand("broadcast_server"))
|
||||||
{
|
{
|
||||||
ret = ix::ws_broadcast_server_main(port, hostname);
|
ret = ix::ws_broadcast_server_main(port, hostname, tlsOptions);
|
||||||
}
|
}
|
||||||
else if (app.got_subcommand("ping"))
|
else if (app.got_subcommand("ping"))
|
||||||
{
|
{
|
||||||
ret = ix::ws_ping_pong_main(url);
|
ret = ix::ws_ping_pong_main(url, tlsOptions);
|
||||||
}
|
}
|
||||||
else if (app.got_subcommand("curl"))
|
else if (app.got_subcommand("curl"))
|
||||||
{
|
{
|
||||||
@ -316,7 +341,8 @@ int main(int argc, char** argv)
|
|||||||
verbose,
|
verbose,
|
||||||
save,
|
save,
|
||||||
output,
|
output,
|
||||||
compress);
|
compress,
|
||||||
|
tlsOptions);
|
||||||
}
|
}
|
||||||
else if (app.got_subcommand("redis_publish"))
|
else if (app.got_subcommand("redis_publish"))
|
||||||
{
|
{
|
||||||
@ -366,7 +392,7 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
else if (app.got_subcommand("httpd"))
|
else if (app.got_subcommand("httpd"))
|
||||||
{
|
{
|
||||||
ret = ix::ws_httpd_main(port, hostname, redirect, redirectUrl);
|
ret = ix::ws_httpd_main(port, hostname, redirect, redirectUrl, tlsOptions);
|
||||||
}
|
}
|
||||||
else if (app.got_subcommand("autobahn"))
|
else if (app.got_subcommand("autobahn"))
|
||||||
{
|
{
|
||||||
|
34
ws/ws.h
34
ws/ws.h
@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <ixwebsocket/IXSocketTLSOptions.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace ix
|
namespace ix
|
||||||
@ -20,13 +21,21 @@ namespace ix
|
|||||||
bool verbose,
|
bool verbose,
|
||||||
bool save,
|
bool save,
|
||||||
const std::string& output,
|
const std::string& output,
|
||||||
bool compress);
|
bool compress,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions);
|
||||||
|
|
||||||
int ws_ping_pong_main(const std::string& url);
|
int ws_ping_pong_main(const std::string& url, const ix::SocketTLSOptions& tlsOptions);
|
||||||
|
|
||||||
int ws_echo_server_main(int port, bool greetings, const std::string& hostname);
|
int ws_echo_server_main(int port,
|
||||||
int ws_broadcast_server_main(int port, const std::string& hostname);
|
bool greetings,
|
||||||
int ws_transfer_main(int port, const std::string& hostname);
|
const std::string& hostname,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions);
|
||||||
|
int ws_broadcast_server_main(int port,
|
||||||
|
const std::string& hostname,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions);
|
||||||
|
int ws_transfer_main(int port,
|
||||||
|
const std::string& hostname,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions);
|
||||||
|
|
||||||
int ws_chat_main(const std::string& url, const std::string& user);
|
int ws_chat_main(const std::string& url, const std::string& user);
|
||||||
|
|
||||||
@ -35,11 +44,17 @@ namespace ix
|
|||||||
bool disableAutomaticReconnection,
|
bool disableAutomaticReconnection,
|
||||||
bool disablePerMessageDeflate,
|
bool disablePerMessageDeflate,
|
||||||
bool binaryMode,
|
bool binaryMode,
|
||||||
uint32_t maxWaitBetweenReconnectionRetries);
|
uint32_t maxWaitBetweenReconnectionRetries,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions);
|
||||||
|
|
||||||
int ws_receive_main(const std::string& url, bool enablePerMessageDeflate, int delayMs);
|
int ws_receive_main(const std::string& url,
|
||||||
|
bool enablePerMessageDeflate,
|
||||||
|
int delayMs,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions);
|
||||||
|
|
||||||
int ws_send_main(const std::string& url, const std::string& path);
|
int ws_send_main(const std::string& url,
|
||||||
|
const std::string& path,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions);
|
||||||
|
|
||||||
int ws_redis_publish_main(const std::string& hostname,
|
int ws_redis_publish_main(const std::string& hostname,
|
||||||
int port,
|
int port,
|
||||||
@ -111,7 +126,8 @@ namespace ix
|
|||||||
int ws_httpd_main(int port,
|
int ws_httpd_main(int port,
|
||||||
const std::string& hostname,
|
const std::string& hostname,
|
||||||
bool redirect,
|
bool redirect,
|
||||||
const std::string& redirectUrl);
|
const std::string& redirectUrl,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions);
|
||||||
|
|
||||||
int ws_autobahn_main(const std::string& url, bool quiet);
|
int ws_autobahn_main(const std::string& url, bool quiet);
|
||||||
|
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
|
|
||||||
namespace ix
|
namespace ix
|
||||||
{
|
{
|
||||||
int ws_broadcast_server_main(int port, const std::string& hostname)
|
int ws_broadcast_server_main(int port,
|
||||||
|
const std::string& hostname,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions)
|
||||||
{
|
{
|
||||||
std::cout << "Listening on " << hostname << ":" << port << std::endl;
|
std::cout << "Listening on " << hostname << ":" << port << std::endl;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "linenoise.hpp"
|
#include "linenoise.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <ixwebsocket/IXSocket.h>
|
#include <ixwebsocket/IXSocket.h>
|
||||||
|
#include <ixwebsocket/IXSocketTLSOptions.h>
|
||||||
#include <ixwebsocket/IXWebSocket.h>
|
#include <ixwebsocket/IXWebSocket.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
@ -186,7 +187,8 @@ namespace ix
|
|||||||
bool disableAutomaticReconnection,
|
bool disableAutomaticReconnection,
|
||||||
bool disablePerMessageDeflate,
|
bool disablePerMessageDeflate,
|
||||||
bool binaryMode,
|
bool binaryMode,
|
||||||
uint32_t maxWaitBetweenReconnectionRetries)
|
uint32_t maxWaitBetweenReconnectionRetries,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions)
|
||||||
{
|
{
|
||||||
std::cout << "Type Ctrl-D to exit prompt..." << std::endl;
|
std::cout << "Type Ctrl-D to exit prompt..." << std::endl;
|
||||||
WebSocketConnect webSocketChat(url,
|
WebSocketConnect webSocketChat(url,
|
||||||
|
@ -10,7 +10,10 @@
|
|||||||
|
|
||||||
namespace ix
|
namespace ix
|
||||||
{
|
{
|
||||||
int ws_echo_server_main(int port, bool greetings, const std::string& hostname)
|
int ws_echo_server_main(int port,
|
||||||
|
bool greetings,
|
||||||
|
const std::string& hostname,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions)
|
||||||
{
|
{
|
||||||
std::cout << "Listening on " << hostname << ":" << port << std::endl;
|
std::cout << "Listening on " << hostname << ":" << port << std::endl;
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <ixwebsocket/IXHttpClient.h>
|
#include <ixwebsocket/IXHttpClient.h>
|
||||||
#include <ixwebsocket/IXWebSocketHttpHeaders.h>
|
#include <ixwebsocket/IXWebSocketHttpHeaders.h>
|
||||||
|
#include <ixwebsocket/IXSocketTLSOptions.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
namespace ix
|
namespace ix
|
||||||
@ -93,7 +94,8 @@ namespace ix
|
|||||||
bool verbose,
|
bool verbose,
|
||||||
bool save,
|
bool save,
|
||||||
const std::string& output,
|
const std::string& output,
|
||||||
bool compress)
|
bool compress,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions)
|
||||||
{
|
{
|
||||||
HttpClient httpClient;
|
HttpClient httpClient;
|
||||||
auto args = httpClient.createRequest();
|
auto args = httpClient.createRequest();
|
||||||
|
@ -16,7 +16,8 @@ namespace ix
|
|||||||
int ws_httpd_main(int port,
|
int ws_httpd_main(int port,
|
||||||
const std::string& hostname,
|
const std::string& hostname,
|
||||||
bool redirect,
|
bool redirect,
|
||||||
const std::string& redirectUrl)
|
const std::string& redirectUrl,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions)
|
||||||
{
|
{
|
||||||
spdlog::info("Listening on {}:{}", hostname, port);
|
spdlog::info("Listening on {}:{}", hostname, port);
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <ixwebsocket/IXSocket.h>
|
#include <ixwebsocket/IXSocket.h>
|
||||||
|
#include <ixwebsocket/IXSocketTLSOptions.h>
|
||||||
#include <ixwebsocket/IXWebSocket.h>
|
#include <ixwebsocket/IXWebSocket.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
@ -123,7 +124,7 @@ namespace ix
|
|||||||
_webSocket.send(text);
|
_webSocket.send(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ws_ping_pong_main(const std::string& url)
|
int ws_ping_pong_main(const std::string& url, const ix::SocketTLSOptions& tlsOptions)
|
||||||
{
|
{
|
||||||
std::cout << "Type Ctrl-D to exit prompt..." << std::endl;
|
std::cout << "Type Ctrl-D to exit prompt..." << std::endl;
|
||||||
WebSocketPingPong webSocketPingPong(url);
|
WebSocketPingPong webSocketPingPong(url);
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <ixcrypto/IXHash.h>
|
#include <ixcrypto/IXHash.h>
|
||||||
#include <ixcrypto/IXUuid.h>
|
#include <ixcrypto/IXUuid.h>
|
||||||
#include <ixwebsocket/IXSocket.h>
|
#include <ixwebsocket/IXSocket.h>
|
||||||
|
#include <ixwebsocket/IXSocketTLSOptions.h>
|
||||||
#include <ixwebsocket/IXWebSocket.h>
|
#include <ixwebsocket/IXWebSocket.h>
|
||||||
#include <msgpack11/msgpack11.hpp>
|
#include <msgpack11/msgpack11.hpp>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
@ -238,7 +239,10 @@ namespace ix
|
|||||||
_webSocket.start();
|
_webSocket.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wsReceive(const std::string& url, bool enablePerMessageDeflate, int delayMs)
|
void wsReceive(const std::string& url,
|
||||||
|
bool enablePerMessageDeflate,
|
||||||
|
int delayMs,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions)
|
||||||
{
|
{
|
||||||
WebSocketReceiver webSocketReceiver(url, enablePerMessageDeflate, delayMs);
|
WebSocketReceiver webSocketReceiver(url, enablePerMessageDeflate, delayMs);
|
||||||
webSocketReceiver.start();
|
webSocketReceiver.start();
|
||||||
@ -254,9 +258,12 @@ namespace ix
|
|||||||
webSocketReceiver.stop();
|
webSocketReceiver.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ws_receive_main(const std::string& url, bool enablePerMessageDeflate, int delayMs)
|
int ws_receive_main(const std::string& url,
|
||||||
|
bool enablePerMessageDeflate,
|
||||||
|
int delayMs,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions)
|
||||||
{
|
{
|
||||||
wsReceive(url, enablePerMessageDeflate, delayMs);
|
wsReceive(url, enablePerMessageDeflate, delayMs, tlsOptions);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} // namespace ix
|
} // namespace ix
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <ixcrypto/IXHash.h>
|
#include <ixcrypto/IXHash.h>
|
||||||
#include <ixcrypto/IXUuid.h>
|
#include <ixcrypto/IXUuid.h>
|
||||||
#include <ixwebsocket/IXSocket.h>
|
#include <ixwebsocket/IXSocket.h>
|
||||||
|
#include <ixwebsocket/IXSocketTLSOptions.h>
|
||||||
#include <ixwebsocket/IXWebSocket.h>
|
#include <ixwebsocket/IXWebSocket.h>
|
||||||
#include <msgpack11/msgpack11.hpp>
|
#include <msgpack11/msgpack11.hpp>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
@ -264,7 +265,8 @@ namespace ix
|
|||||||
void wsSend(const std::string& url,
|
void wsSend(const std::string& url,
|
||||||
const std::string& path,
|
const std::string& path,
|
||||||
bool enablePerMessageDeflate,
|
bool enablePerMessageDeflate,
|
||||||
bool throttle)
|
bool throttle,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions)
|
||||||
{
|
{
|
||||||
WebSocketSender webSocketSender(url, enablePerMessageDeflate);
|
WebSocketSender webSocketSender(url, enablePerMessageDeflate);
|
||||||
webSocketSender.start();
|
webSocketSender.start();
|
||||||
@ -280,12 +282,14 @@ namespace ix
|
|||||||
webSocketSender.stop();
|
webSocketSender.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ws_send_main(const std::string& url, const std::string& path)
|
int ws_send_main(const std::string& url,
|
||||||
|
const std::string& path,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions)
|
||||||
{
|
{
|
||||||
bool throttle = false;
|
bool throttle = false;
|
||||||
bool enablePerMessageDeflate = false;
|
bool enablePerMessageDeflate = false;
|
||||||
|
|
||||||
wsSend(url, path, enablePerMessageDeflate, throttle);
|
wsSend(url, path, enablePerMessageDeflate, throttle, tlsOptions);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} // namespace ix
|
} // namespace ix
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
|
|
||||||
namespace ix
|
namespace ix
|
||||||
{
|
{
|
||||||
int ws_transfer_main(int port, const std::string& hostname)
|
int ws_transfer_main(int port,
|
||||||
|
const std::string& hostname,
|
||||||
|
const ix::SocketTLSOptions& tlsOptions)
|
||||||
{
|
{
|
||||||
std::cout << "ws_transfer: Listening on " << hostname << ":" << port << std::endl;
|
std::cout << "ws_transfer: Listening on " << hostname << ":" << port << std::endl;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user