- 
    Bug 
- 
    Resolution: Done
- 
    P2: Important 
- 
    5.15.8, 6.2.2
- 
        e1c92b5748 (qt/qtwebsockets/dev) 8bec50aeb7 (qt/qtwebsockets/6.3) 131a5a09e9 (qt/qtwebsockets/6.2) 131a5a09e9 (qt/tqtc-qtwebsockets/6.2) 8bec50aeb7 (qt/tqtc-qtwebsockets/6.3) e1c92b5748 (qt/tqtc-qtwebsockets/dev) 131a5a09e9 (qt/qtwebsockets/6.2.4)
QWebSocket uses QueuedConnection to handle readyRead() signals (see qwebsocket_p.cpp in makeConnections()) from the backing QTcp/SslSocket, but it uses direct connection from the socket to notify of disconnection.
https://code.qt.io/cgit/qt/qtwebsockets.git/tree/src/websockets/qwebsocket_p.cpp#n624
That can lead to situation where disconnected() signal is fired first and then the message is reported after that, which complicates the application logic a bit because this would have to be taken into account.