summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/webchannel/chatserver-cpp/chatserver.cpp9
-rw-r--r--examples/webchannel/chatserver-cpp/main.cpp12
-rw-r--r--examples/webchannel/shared/websocketclientwrapper.cpp5
3 files changed, 12 insertions, 14 deletions
diff --git a/examples/webchannel/chatserver-cpp/chatserver.cpp b/examples/webchannel/chatserver-cpp/chatserver.cpp
index 9bc45ce..74da4c3 100644
--- a/examples/webchannel/chatserver-cpp/chatserver.cpp
+++ b/examples/webchannel/chatserver-cpp/chatserver.cpp
@@ -115,12 +115,14 @@ bool ChatServer::sendMessage(const QString& user, const QString& msg)
}
}
-void ChatServer::sendKeepAlive() {
+void ChatServer::sendKeepAlive()
+{
emit keepAlive();
m_keepAliveCheckTimer->start();
}
-void ChatServer::checkKeepAliveResponses() {
+void ChatServer::checkKeepAliveResponses()
+{
qDebug() << "Keep Alive Check" << m_stillAliveUsers;
m_userList = m_stillAliveUsers;
m_stillAliveUsers.clear();
@@ -128,7 +130,8 @@ void ChatServer::checkKeepAliveResponses() {
emit userListChanged();
}
-void ChatServer::keepAliveResponse(const QString& user) {
+void ChatServer::keepAliveResponse(const QString& user)
+{
m_stillAliveUsers.append(user);
}
diff --git a/examples/webchannel/chatserver-cpp/main.cpp b/examples/webchannel/chatserver-cpp/main.cpp
index 240518c..ea27e87 100644
--- a/examples/webchannel/chatserver-cpp/main.cpp
+++ b/examples/webchannel/chatserver-cpp/main.cpp
@@ -49,17 +49,13 @@
****************************************************************************/
#include "qwebchannel.h"
-
-#include <QCoreApplication>
-#include <QUrl>
-#include <QDebug>
-
-#include <QtWebSockets/QWebSocketServer>
+#include "chatserver.h"
#include "../shared/websocketclientwrapper.h"
#include "../shared/websockettransport.h"
-#include "chatserver.h"
+#include <QtWebSockets/QWebSocketServer>
+#include <QCoreApplication>
int main(int argc, char** argv)
{
@@ -82,7 +78,7 @@ int main(int argc, char** argv)
// setup the dialog and publish it to the QWebChannel
ChatServer* chatserver = new ChatServer(&app);
- channel.registerObject("chatserver", chatserver);
+ channel.registerObject(QStringLiteral("chatserver"), chatserver);
return app.exec();
}
diff --git a/examples/webchannel/shared/websocketclientwrapper.cpp b/examples/webchannel/shared/websocketclientwrapper.cpp
index 0778cee..3743bdd 100644
--- a/examples/webchannel/shared/websocketclientwrapper.cpp
+++ b/examples/webchannel/shared/websocketclientwrapper.cpp
@@ -49,13 +49,12 @@
****************************************************************************/
#include "websocketclientwrapper.h"
+#include "websockettransport.h"
#include <QtWebSockets/QWebSocketServer>
-#include "websockettransport.h"
-
/*!
- \brief Wrapps connected QWebSockets clients in WebSocketTransport objects.
+ \brief Wraps connected QWebSockets clients in WebSocketTransport objects.
This code is all that is required to connect incoming WebSockets to the WebChannel. Any kind
of remote JavaScript client that supports WebSockets can thus receive messages and access the