diff --git a/SMSubServer.cpp b/SMSubServer.cpp index 8548165..aa1cf6e 100644 --- a/SMSubServer.cpp +++ b/SMSubServer.cpp @@ -46,7 +46,9 @@ SMSubServer::SMSubServer(SMSubServerSettings *serverSettings, const QString &soc SMSubServer::SMSubServer(SMSubServerSettings *serverSettings, const QString &serverName, const quint16 &port) : serverSettings(serverSettings) { QWebSocketServer *webSocketServer = new QWebSocketServer(serverName, QWebSocketServer::NonSecureMode, this); +#if QT_VERSION >= 0x060400 webSocketServer->setSupportedSubprotocols(QStringList() << "smsub" << "smsub_json"); +#endif webSocketServer->listen(QHostAddress::LocalHost, port); QObject::connect(webSocketServer, &QWebSocketServer::newConnection, this, &SMSubServer::newConnection); @@ -88,8 +90,10 @@ void SMSubServer::newConnection() socket = webSocket; QTextStream(stderr) << QString("WebSocket %1:%2 connected!").arg(webSocket->peerAddress().toString(), QString::number(webSocket->peerPort())) << smsub_endl; +#if QT_VERSION >= 0x060400 if (webSocket->subprotocol() == "smsub_json") socket->setProperty("ReceiveJson", true); +#endif } else { // Just for being sure