QWebSocketProtocol Namespace

Contains constants related to the WebSocket standard. More...

Header: #include <QWebSocketProtocol>
CMake: find_package(Qt6 REQUIRED COMPONENTS WebSockets)
target_link_libraries(mytarget PRIVATE Qt6::WebSockets)
qmake: QT += websockets

Types

enum CloseCode { CloseCodeNormal, CloseCodeGoingAway, CloseCodeProtocolError, CloseCodeDatatypeNotSupported, CloseCodeReserved1004, …, CloseCodeTlsHandshakeFailed }
enum Version { VersionUnknown, Version0, Version4, Version5, Version6, …, VersionLatest }

Detailed Description

Type Documentation

enum QWebSocketProtocol::CloseCode

The close codes supported by WebSockets V13

ConstantValueDescription
QWebSocketProtocol::CloseCodeNormal1000Normal closure
QWebSocketProtocol::CloseCodeGoingAway1001Going away
QWebSocketProtocol::CloseCodeProtocolError1002Protocol error
QWebSocketProtocol::CloseCodeDatatypeNotSupported1003Unsupported data
QWebSocketProtocol::CloseCodeReserved10041004Reserved
QWebSocketProtocol::CloseCodeMissingStatusCode1005No status received
QWebSocketProtocol::CloseCodeAbnormalDisconnection1006Abnormal closure
QWebSocketProtocol::CloseCodeWrongDatatype1007Invalid frame payload data
QWebSocketProtocol::CloseCodePolicyViolated1008Policy violation
QWebSocketProtocol::CloseCodeTooMuchData1009Message too big
QWebSocketProtocol::CloseCodeMissingExtension1010Mandatory extension missing
QWebSocketProtocol::CloseCodeBadOperation1011Internal server error
QWebSocketProtocol::CloseCodeTlsHandshakeFailed1015TLS handshake failed

See also QWebSocket::close().

enum QWebSocketProtocol::Version

The different defined versions of the WebSocket protocol.

For an overview of the differences between the different protocols, see pywebsocket's WebSocketProtocolSpec.

ConstantValueDescription
QWebSocketProtocol::VersionUnknown-1Unknown or unspecified version.
QWebSocketProtocol::Version00hixie76 and hybi-00. Works with key1, key2 and a key in the payload. Attribute: Sec-WebSocket-Draft value 0. Not supported by QtWebSockets.
QWebSocketProtocol::Version44hybi-04. Changed handshake: key1, key2, key3 ==> Sec-WebSocket-Key, Sec-WebSocket-Nonce, Sec-WebSocket-Accept Sec-WebSocket-Draft renamed to Sec-WebSocket-Version Sec-WebSocket-Version = 4. Not supported by QtWebSockets.
QWebSocketProtocol::Version55hybi-05. Sec-WebSocket-Version = 5 Removed Sec-WebSocket-Nonce Added Sec-WebSocket-Accept. Not supported by QtWebSockets.
QWebSocketProtocol::Version66Sec-WebSocket-Version = 6. Not supported by QtWebSockets.
QWebSocketProtocol::Version77hybi-07. Sec-WebSocket-Version = 7. Not supported by QtWebSockets.
QWebSocketProtocol::Version88hybi-8, hybi-9, hybi-10, hybi-11 and hybi-12. Status codes 1005 and 1006 are added and all codes are now unsigned Internal error results in 1006. Not supported by QtWebSockets.
QWebSocketProtocol::Version1313hybi-13, hybi14, hybi-15, hybi-16, hybi-17 and RFC 6455. Sec-WebSocket-Version = 13 Status code 1004 is now reserved Added 1008, 1009 and 1010 Must support TLS Clarify multiple version support. Supported by QtWebSockets.
QWebSocketProtocol::VersionLatestVersion13Refers to the latest known version to QtWebSockets.