server: use std::string in broadcast

This commit is contained in:
Stéphane L 2019-01-01 05:29:51 +01:00
parent 11617eea99
commit 40e2d410dd
3 changed files with 4 additions and 4 deletions

View File

@ -222,7 +222,7 @@ void WSEvents::broadcastUpdate(const char* updateType,
obs_data_apply(update, additionalFields); obs_data_apply(update, additionalFields);
QString json = obs_data_get_json(update); QString json = obs_data_get_json(update);
_srv->broadcast(json); _srv->broadcast(json.toStdString());
if (Config::Current()->DebugEnabled) if (Config::Current()->DebugEnabled)
blog(LOG_DEBUG, "Update << '%s'", json.toUtf8().constData()); blog(LOG_DEBUG, "Update << '%s'", json.toUtf8().constData());

View File

@ -100,7 +100,7 @@ void WSServer::stop()
blog(LOG_INFO, "server stopped successfully"); blog(LOG_INFO, "server stopped successfully");
} }
void WSServer::broadcast(QString message) void WSServer::broadcast(std::string message)
{ {
QMutexLocker locker(&_clMutex); QMutexLocker locker(&_clMutex);
for (connection_hdl hdl : _connections) { for (connection_hdl hdl : _connections) {
@ -110,7 +110,7 @@ void WSServer::broadcast(QString message)
continue; continue;
} }
} }
_server.send(hdl, message.toStdString(), websocketpp::frame::opcode::text); _server.send(hdl, message, websocketpp::frame::opcode::text);
} }
} }

View File

@ -54,7 +54,7 @@ public:
virtual ~WSServer(); virtual ~WSServer();
void start(quint16 port); void start(quint16 port);
void stop(); void stop();
void broadcast(QString message); void broadcast(std::string message);
private: private:
static WSServerPtr _instance; static WSServerPtr _instance;