Socket Factory has only one function which works for server and client code, and can do tls for both
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
#include <iostream>
|
||||
#include <ixwebsocket/IXSocket.h>
|
||||
#include <ixwebsocket/IXSocketFactory.h>
|
||||
#include <ixwebsocket/IXSocketTLSOptions.h>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
@ -20,7 +21,8 @@ namespace ix
|
||||
{
|
||||
bool tls = false;
|
||||
std::string errorMsg;
|
||||
_socket = createSocket(tls, errorMsg);
|
||||
SocketTLSOptions tlsOptions;
|
||||
_socket = createSocket(tls, -1, errorMsg, tlsOptions);
|
||||
|
||||
if (!_socket)
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ namespace ix
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
_stopHandlingConnections = false;
|
||||
|
||||
|
||||
SocketServer::stop();
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ namespace ix
|
||||
// now dispatch the message to subscribers (write custom method)
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
auto it = _subscribers.find(channel);
|
||||
if (it == _subscribers.end())
|
||||
if (it == _subscribers.end())
|
||||
{
|
||||
// return the number of clients that received the message, 0 in that case
|
||||
socket->writeBytes(":0\r\n", cb);
|
||||
|
@ -211,7 +211,7 @@ namespace snake
|
||||
ss << "Subscribing to " << appChannel << "...";
|
||||
ix::IXCoreLogger::Log(ss.str().c_str());
|
||||
}
|
||||
|
||||
|
||||
if (!redisClient.subscribe(appChannel, responseCallback, callback))
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
@ -102,7 +102,7 @@ namespace snake
|
||||
ss << "Received " << msg->wireSize << " bytes" << std::endl;
|
||||
processCobraMessage(state, webSocket, _appConfig, msg->str);
|
||||
}
|
||||
|
||||
|
||||
ix::IXCoreLogger::Log(ss.str().c_str());
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user