Skip to content

Commit

Permalink
Emit a new signal whenever a websocket client connects to socket. #16
Browse files Browse the repository at this point in the history
Send app settings to client.
  • Loading branch information
abertschi committed May 30, 2015
1 parent 1cefe9d commit b7b7dba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions harbour-wlan-keyboard/src/server_configurator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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/");
Expand Down Expand Up @@ -136,7 +136,7 @@ void ServerConfigurator::onNewClientConnected()

void ServerConfigurator::onSettingsChanged(Settings * s)
{

qDebug("Client is requesting app settigs");
sendSettingsToWsClients(s->toJson());
}

Expand Down
1 change: 1 addition & 0 deletions harbour-wlan-keyboard/src/websocket_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down

0 comments on commit b7b7dba

Please sign in to comment.