Congratulations to our 2022 Qt Champions!

QWebsocket signal disconnected and method close unrelated ??

  • Hi,

    If you saw my previous question this one ain't related (I try to go on with my project without ssl until I know how to use it correctly).

    Here what I did :
    Take the SslEchoClient from qt examples and add this line :

    connect(&m_webSocket, &QWebSocket::disconnected,  this,  SslEchoClient::onClose);

    to void SslEchoClient::onConnected();
    Then I add The simple method below :

    void SslEchoClient::onClose(){
        qDebug() << "Close code:" << m_webSocket.closeCode();

    I then took SslEchoServer and added that line :


    after the line


    The Client debug output is
    Message received: "Hello, world!"
    Close code: 1000

    which is the value for the default closeCode : the normal close code... why ?

  • Moderators

    Does this answer your question?

    Kind regards.

  • Hmmm not really dude : the server close with

    as mentioned in my previous post;
    but the client output 1000 which is QWebSocketProtocol::CloseCodeNormal

    So the given link just confirm there's a bug or disconnected and close are not realted (which sounds wrong)

  • OK guys i can confirm this is a bug in the Qt5.3 (linux version at least); as the exact same code on Qt5.5 on windows produces the followin output :
    Message received: "Hello, world!"
    Close code: 1002

    Was already reported btw : [](link url)