diff --git a/.qmake.conf b/.qmake.conf
index bc074d54752766d8f6f6e01c39217add49e0fb7c..b9d358fa74408f7f4378ce9a2d8210bd6e660eb6 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -3,4 +3,4 @@ load(qt_build_config)
 CONFIG += warning_clean
 DEFINES += QT_NO_FOREACH
 
-MODULE_VERSION = 5.12.0
+MODULE_VERSION = 5.12.1
diff --git a/dist/changes-5.11.3 b/dist/changes-5.11.3
new file mode 100644
index 0000000000000000000000000000000000000000..f71fa34123cdab69945ceb9198629e9a0a85ef4f
--- /dev/null
+++ b/dist/changes-5.11.3
@@ -0,0 +1,20 @@
+Qt 5.11.3 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.11.0 through 5.11.2.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.11 series is binary compatible with the 5.10.x series.
+Applications compiled for 5.10 will continue to run with 5.11.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+ - This release contains only minor code improvements.
diff --git a/src/websockets/qwebsocket_p.h b/src/websockets/qwebsocket_p.h
index fd631d4c433f7269ef034feba8fa43407d76f018..4b39dfce80856d5f2ab01880f582c5cbb7f688db 100644
--- a/src/websockets/qwebsocket_p.h
+++ b/src/websockets/qwebsocket_p.h
@@ -158,6 +158,7 @@ public:
     void close(QWebSocketProtocol::CloseCode closeCode, QString reason);
     void open(const QNetworkRequest &request, bool mask);
     void ping(const QByteArray &payload);
+    void setSocketState(QAbstractSocket::SocketState state);
 
 private:
     QWebSocketPrivate(QTcpSocket *pTcpSocket, QWebSocketProtocol::Version version);
@@ -168,7 +169,6 @@ private:
     void setProtocol(const QString &protocol);
     void setExtension(const QString &extension);
     void enableMasking(bool enable);
-    void setSocketState(QAbstractSocket::SocketState state);
     void setErrorString(const QString &errorString);
 
     void socketDestroyed(QObject *socket);
diff --git a/src/websockets/qwebsocket_wasm_p.cpp b/src/websockets/qwebsocket_wasm_p.cpp
index 2ac61baf631c7cd0096266eb85a6b6eba66b7e46..922d6a84bd30e6a3ea4a2c0ed09fbe53615a0c9e 100644
--- a/src/websockets/qwebsocket_wasm_p.cpp
+++ b/src/websockets/qwebsocket_wasm_p.cpp
@@ -63,6 +63,7 @@ static void q_onCloseCallback(val event)
     QWebSocketPrivate *wsp = reinterpret_cast<QWebSocketPrivate*>(target["data-context"].as<quintptr>());
     Q_ASSERT (wsp);
 
+    wsp->setSocketState(QAbstractSocket::UnconnectedState);
     emit wsp->q_func()->disconnected();
 }
 
@@ -73,6 +74,7 @@ static void q_onOpenCallback(val event)
     QWebSocketPrivate *wsp = reinterpret_cast<QWebSocketPrivate*>(target["data-context"].as<quintptr>());
     Q_ASSERT (wsp);
 
+    wsp->setSocketState(QAbstractSocket::ConnectedState);
     emit wsp->q_func()->connected();
 }
 
@@ -149,6 +151,7 @@ void QWebSocketPrivate::close(QWebSocketProtocol::CloseCode closeCode, QString r
     m_closeCode = closeCode;
     m_closeReason = reason;
     Q_EMIT q->aboutToClose();
+    setSocketState(QAbstractSocket::ClosingState);
 
     socketContext.call<void>("close", static_cast<quint16>(closeCode),
                              reason.toLatin1().toStdString());
@@ -165,6 +168,7 @@ void QWebSocketPrivate::open(const QNetworkRequest &request, bool mask)
         return;
     }
 
+    setSocketState(QAbstractSocket::ConnectingState);
     const std::string urlbytes = url.toString().toStdString();
 
     // HTML WebSockets do not support arbitrary request headers, but