[QtWebsockets] How to respond to pings sent by the server
-
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?
-
A ping from a server is automatically answered - see https://code.woboq.org/qt5/qtwebsockets/src/websockets/qwebsocket_p.cpp.html#_ZN17QWebSocketPrivate11processPingERK10QByteArray
-
Fell free to open a bug report or even better write a patch for it.
-
Patch pending: https://codereview.qt-project.org/c/qt/qtwebsockets/+/326931