summaryrefslogtreecommitdiff
path: root/examples/simplechat/chatserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/simplechat/chatserver.cpp')
-rw-r--r--examples/simplechat/chatserver.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/simplechat/chatserver.cpp b/examples/simplechat/chatserver.cpp
index 0e1a0e5..0ca4b47 100644
--- a/examples/simplechat/chatserver.cpp
+++ b/examples/simplechat/chatserver.cpp
@@ -61,6 +61,15 @@ ChatServer::ChatServer(quint16 port, QObject *parent) :
this, &ChatServer::onNewConnection);
}
}
+
+ChatServer::~ChatServer()
+{
+ m_pWebSocketServer->close();
+ while (!m_clients.isEmpty()) {
+ QWebSocket *pWebSocket = m_clients.takeFirst();
+ delete pWebSocket;
+ }
+}
//! [constructor]
//! [onNewConnection]