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. [QtWebsockets] How to respond to pings sent by the server
Qt 6.11 is out! See what's new in the release blog

[QtWebsockets] How to respond to pings sent by the server

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.7k 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.
  • razaqqR Offline
    razaqqR Offline
    razaqq
    wrote on last edited by
    #1

    The websocket standard allows either the client or server to send pings (opcode 0x9) to the other side to which they have to respond with a pong (opcode 0xA).
    Qt's websocket client implementation (https://doc.qt.io/qt-5/qwebsocket.html) has a ping() function to send a ping to the server and a pong signal that is emmited when a pong response is received.
    However its lacking any sort of way to respond to a ping sent by the server. Without a proper way to repond to server pings its missing one of the fundamental features of websockets.

    Am I missing something or is this basic feature really missing?

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      A ping from a server is automatically answered - see https://code.woboq.org/qt5/qtwebsockets/src/websockets/qwebsocket_p.cpp.html#_ZN17QWebSocketPrivate11processPingERK10QByteArray

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2
      • razaqqR Offline
        razaqqR Offline
        razaqq
        wrote on last edited by
        #3

        that should be documented somewhere in my opinion

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Fell free to open a bug report or even better write a patch for it.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          1
          • aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Patch pending: https://codereview.qt-project.org/c/qt/qtwebsockets/+/326931

            Qt has to stay free or it will die.

            1 Reply Last reply
            3
            • T Offline
              T Offline
              Trigve
              wrote on last edited by
              #6

              @razaqq I'm curious about the problem you're solving that is hard without "proper" ping support in QWebSocket?

              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