summaryrefslogtreecommitdiff
path: root/examples/websockets/simplechat
diff options
context:
space:
mode:
Diffstat (limited to 'examples/websockets/simplechat')
-rw-r--r--examples/websockets/simplechat/chatserver.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/examples/websockets/simplechat/chatserver.cpp b/examples/websockets/simplechat/chatserver.cpp
index 33e5d8d..ae207f5 100644
--- a/examples/websockets/simplechat/chatserver.cpp
+++ b/examples/websockets/simplechat/chatserver.cpp
@@ -57,8 +57,7 @@ QT_USE_NAMESPACE
//! [constructor]
ChatServer::ChatServer(quint16 port, QObject *parent) :
QObject(parent),
- m_pWebSocketServer(Q_NULLPTR),
- m_clients()
+ m_pWebSocketServer(Q_NULLPTR)
{
m_pWebSocketServer = new QWebSocketServer(QStringLiteral("Chat Server"),
QWebSocketServer::NonSecureMode,
@@ -94,8 +93,7 @@ void ChatServer::onNewConnection()
void ChatServer::processMessage(QString message)
{
QWebSocket *pSender = qobject_cast<QWebSocket *>(sender());
- Q_FOREACH (QWebSocket *pClient, m_clients)
- {
+ for (QWebSocket *pClient : qAsConst(m_clients)) {
if (pClient != pSender) //don't echo message back to sender
{
pClient->sendTextMessage(message);