Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. readyRead in QWebSocket

readyRead in QWebSocket

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 600 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mikeeeeee
    wrote on last edited by
    #1

    Hi!
    In QTcpSocket work signal readyRead , but in QWebSocket this signal not work. How to replace this signal?

    J.HilkJ Pablo J. RoginaP 2 Replies Last reply
    0
    • M Mikeeeeee

      Hi!
      In QTcpSocket work signal readyRead , but in QWebSocket this signal not work. How to replace this signal?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #2

      QWebSocket directly derives from QTcpSocket. -> ReadyRead does work


      see here: https://forum.qt.io/topic/106325/readyread-in-qwebsocket/6


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      Pablo J. RoginaP 1 Reply Last reply
      0
      • J.HilkJ J.Hilk

        QWebSocket directly derives from QTcpSocket. -> ReadyRead does work


        see here: https://forum.qt.io/topic/106325/readyread-in-qwebsocket/6

        Pablo J. RoginaP Offline
        Pablo J. RoginaP Offline
        Pablo J. Rogina
        wrote on last edited by
        #3

        @j-hilk said in readyRead in QWebSocket:

        QWebSocket directly derives from QTcpSocket

        No per online documentation

        Inherits: QObject

        ReadyRead does work

        Have you really tried it?
        Again, from online documentation there's no signal readyRead() at all...

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        J.HilkJ 1 Reply Last reply
        0
        • Pablo J. RoginaP Pablo J. Rogina

          @j-hilk said in readyRead in QWebSocket:

          QWebSocket directly derives from QTcpSocket

          No per online documentation

          Inherits: QObject

          ReadyRead does work

          Have you really tried it?
          Again, from online documentation there's no signal readyRead() at all...

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by J.Hilk
          #4

          @pablo-j-rogina
          per source code it does

          QWebSocketPrivate::QWebSocketPrivate(QTcpSocket *pTcpSocket, QWebSocketProtocol::Version version,
                                               QWebSocket *pWebSocket) :
              QObjectPrivate(),
              q_ptr(pWebSocket),
              m_pSocket(pTcpSocket),
              m_errorString(pTcpSocket->errorString()),
              m_version(version),
              m_resourceName(),
              m_request(),
              m_origin(),
              m_protocol(),
              m_extension(),
              m_socketState(pTcpSocket->state()),
              m_pauseMode(pTcpSocket->pauseMode()),
              m_readBufferSize(pTcpSocket->readBufferSize()),
              m_key(),
              m_mustMask(true),
              m_isClosingHandshakeSent(false),
              m_isClosingHandshakeReceived(false),
              m_closeCode(QWebSocketProtocol::CloseCodeNormal),
              m_closeReason(),
              m_pingTimer(),
              m_dataProcessor(),
              m_configuration(),
              m_pMaskGenerator(&m_defaultMaskGenerator),
              m_defaultMaskGenerator(),
              m_handshakeState(NothingDoneState)
          {
          }
          

          It's from the private web socket class part so it may change in the future, but currently it is

          and no, I haven't tried.
          No example at hand right now


          But I concur, going through the publicly available functions and signals, readyRead is indeed not forwarded. Interesting 🤔


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          Pablo J. RoginaP 1 Reply Last reply
          0
          • M Mikeeeeee

            Hi!
            In QTcpSocket work signal readyRead , but in QWebSocket this signal not work. How to replace this signal?

            Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on last edited by
            #5

            @mikeeeeee you may want to look at this example.

            You may need to think using a slightly different approach, with signals like connected(), disconnected(), binaryMessageReceived(), textMessageReceived() and so on.

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • J.HilkJ J.Hilk

              @pablo-j-rogina
              per source code it does

              QWebSocketPrivate::QWebSocketPrivate(QTcpSocket *pTcpSocket, QWebSocketProtocol::Version version,
                                                   QWebSocket *pWebSocket) :
                  QObjectPrivate(),
                  q_ptr(pWebSocket),
                  m_pSocket(pTcpSocket),
                  m_errorString(pTcpSocket->errorString()),
                  m_version(version),
                  m_resourceName(),
                  m_request(),
                  m_origin(),
                  m_protocol(),
                  m_extension(),
                  m_socketState(pTcpSocket->state()),
                  m_pauseMode(pTcpSocket->pauseMode()),
                  m_readBufferSize(pTcpSocket->readBufferSize()),
                  m_key(),
                  m_mustMask(true),
                  m_isClosingHandshakeSent(false),
                  m_isClosingHandshakeReceived(false),
                  m_closeCode(QWebSocketProtocol::CloseCodeNormal),
                  m_closeReason(),
                  m_pingTimer(),
                  m_dataProcessor(),
                  m_configuration(),
                  m_pMaskGenerator(&m_defaultMaskGenerator),
                  m_defaultMaskGenerator(),
                  m_handshakeState(NothingDoneState)
              {
              }
              

              It's from the private web socket class part so it may change in the future, but currently it is

              and no, I haven't tried.
              No example at hand right now


              But I concur, going through the publicly available functions and signals, readyRead is indeed not forwarded. Interesting 🤔

              Pablo J. RoginaP Offline
              Pablo J. RoginaP Offline
              Pablo J. Rogina
              wrote on last edited by
              #6

              @j-hilk said in readyRead in QWebSocket:

              per source code it does

              No, it does not

              The source code snippet you posted clearly shows that QWebSocketPrivate class (the underlying implementation for QWebSocket) has QTcpSocket as a member, but it doesn't derive from it.

              QWebSocketPrivate::QWebSocketPrivate(QTcpSocket *pTcpSocket, QWebSocketProtocol::Version version, QWebSocket *pWebSocket) :
                  QObjectPrivate(),
              ...
                  m_pSocket(pTcpSocket),
              ...
              

              And keeping on looking at source code, you'll find out that the QTcpSocket::readyRead() signal is "hidden" in the QWebsocketPrivate class, as it is handled internally

                  QObjectPrivate::connect(pTcpSocket, &QAbstractSocket::readyRead, this, &QWebSocketPrivate::processData, Qt::QueuedConnection);
              

              Upvote the answer(s) that helped you solve the issue
              Use "Topic Tools" button to mark your post as Solved
              Add screenshots via postimage.org
              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

              J.HilkJ 1 Reply Last reply
              0
              • Pablo J. RoginaP Pablo J. Rogina

                @j-hilk said in readyRead in QWebSocket:

                per source code it does

                No, it does not

                The source code snippet you posted clearly shows that QWebSocketPrivate class (the underlying implementation for QWebSocket) has QTcpSocket as a member, but it doesn't derive from it.

                QWebSocketPrivate::QWebSocketPrivate(QTcpSocket *pTcpSocket, QWebSocketProtocol::Version version, QWebSocket *pWebSocket) :
                    QObjectPrivate(),
                ...
                    m_pSocket(pTcpSocket),
                ...
                

                And keeping on looking at source code, you'll find out that the QTcpSocket::readyRead() signal is "hidden" in the QWebsocketPrivate class, as it is handled internally

                    QObjectPrivate::connect(pTcpSocket, &QAbstractSocket::readyRead, this, &QWebSocketPrivate::processData, Qt::QueuedConnection);
                
                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by
                #7

                @pablo-j-rogina
                jup, I agree, my initial statement was incorrect


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved