From b7b7dbaa9a2b7d02b87a4ac935c70fb60123f4b4 Mon Sep 17 00:00:00 2001 From: Andrin Bertschi Date: Sat, 30 May 2015 17:49:05 +0200 Subject: [PATCH] Emit a new signal whenever a websocket client connects to socket. #16 Send app settings to client. --- harbour-wlan-keyboard/src/server_configurator.cpp | 4 ++-- harbour-wlan-keyboard/src/websocket_server.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/harbour-wlan-keyboard/src/server_configurator.cpp b/harbour-wlan-keyboard/src/server_configurator.cpp index 21a18ec..e9b2326 100644 --- a/harbour-wlan-keyboard/src/server_configurator.cpp +++ b/harbour-wlan-keyboard/src/server_configurator.cpp @@ -17,7 +17,7 @@ void ServerConfigurator::configure(QQuickView *view) this->m_websocket_server = new websocket_server(QObject::parent()); view->rootContext()->setContextProperty("websocketServer", m_websocket_server); connect(m_websocket_server, SIGNAL(processMessage(QString*)), this, SLOT(processSocketMessage(QString*))); - //connect(m_websocket_server, SIGNAL(processNewClientConnected())), this, SLOT(onNewClientConnected()); + connect(m_websocket_server, SIGNAL(processNewClientConnected()), this, SLOT(onNewClientConnected())); this->m_http_server = new http_server(QObject::parent()); m_http_server->setBasePath("/usr/share/harbour-wlan-keyboard/publish/"); @@ -136,7 +136,7 @@ void ServerConfigurator::onNewClientConnected() void ServerConfigurator::onSettingsChanged(Settings * s) { - + qDebug("Client is requesting app settigs"); sendSettingsToWsClients(s->toJson()); } diff --git a/harbour-wlan-keyboard/src/websocket_server.cpp b/harbour-wlan-keyboard/src/websocket_server.cpp index c504187..9875ad6 100644 --- a/harbour-wlan-keyboard/src/websocket_server.cpp +++ b/harbour-wlan-keyboard/src/websocket_server.cpp @@ -70,6 +70,7 @@ void websocket_server::processNewConnection() QObject::connect(clientSocket, SIGNAL(pong(quint64)), this, SLOT(processPong(quint64))); m_clients << clientSocket; + emit processNewClientConnected(); qDebug() << "New websocket client connected"; }