diff --git a/examples/sslechoclient/sslechoclient.cpp b/examples/sslechoclient/sslechoclient.cpp
index fdf00df753fd8cff68a4db23d9389d8c983ea05d..cf5b9764c4cf59a8aa095fa63252836730f2391a 100644
--- a/examples/sslechoclient/sslechoclient.cpp
+++ b/examples/sslechoclient/sslechoclient.cpp
@@ -40,6 +40,8 @@
 ****************************************************************************/
 #include "sslechoclient.h"
 #include <QtCore/QDebug>
+#include <QtWebSockets/QWebSocket>
+#include <QCoreApplication>
 
 QT_USE_NAMESPACE
 
@@ -49,6 +51,9 @@ SslEchoClient::SslEchoClient(const QUrl &url, QObject *parent) :
     m_webSocket()
 {
     connect(&m_webSocket, &QWebSocket::connected, this, &SslEchoClient::onConnected);
+    typedef void (QWebSocket:: *sslErrorsSignal)(const QList<QSslError> &);
+    connect(&m_webSocket, static_cast<sslErrorsSignal>(&QWebSocket::sslErrors),
+            this, &SslEchoClient::onSslErrors);
     m_webSocket.open(QUrl(url));
 }
 //! [constructor]
@@ -67,5 +72,12 @@ void SslEchoClient::onConnected()
 void SslEchoClient::onTextMessageReceived(QString message)
 {
     qDebug() << "Message received:" << message;
+    qApp->quit();
+}
+
+void SslEchoClient::onSslErrors(const QList<QSslError> &errors)
+{
+    Q_UNUSED(errors);
+    m_webSocket.ignoreSslErrors();
 }
 //! [onTextMessageReceived]
diff --git a/examples/sslechoclient/sslechoclient.h b/examples/sslechoclient/sslechoclient.h
index cec9e9d0d84ab956b976f447ebb6e7d94162d881..7ec373b9de15a5226abe9f687b1ef4828e87e856 100644
--- a/examples/sslechoclient/sslechoclient.h
+++ b/examples/sslechoclient/sslechoclient.h
@@ -43,6 +43,10 @@
 
 #include <QtCore/QObject>
 #include <QtWebSockets/QWebSocket>
+#include <QtNetwork/QSslError>
+#include <QtCore/QList>
+#include <QtCore/QString>
+#include <QtCore/QUrl>
 
 QT_FORWARD_DECLARE_CLASS(QWebSocket)
 
@@ -52,13 +56,10 @@ class SslEchoClient : public QObject
 public:
     explicit SslEchoClient(const QUrl &url, QObject *parent = Q_NULLPTR);
 
-Q_SIGNALS:
-
-public Q_SLOTS:
-
 private Q_SLOTS:
     void onConnected();
     void onTextMessageReceived(QString message);
+    void onSslErrors(const QList<QSslError> &errors);
 
 private:
     QWebSocket m_webSocket;