QWebSocketHandshakeOptions Class
The QWebSocketHandshakeOptions class holds options of a WebSocket client's opening handshake. More…
| Header | #include <QWebSocketHandshakeOptions> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::WebSockets) |
| Module | Nt WebSockets C++ Classes |
| Since | 6.4 |
List of all members, including inherited members
Public Functions
| QWebSocketHandshakeOptions() | |
| QWebSocketHandshakeOptions(const QWebSocketHandshakeOptions &other) | |
| QWebSocketHandshakeOptions(QWebSocketHandshakeOptions &&other) | |
| QWebSocketHandshakeOptions & | operator=(const QWebSocketHandshakeOptions &other) |
| QWebSocketHandshakeOptions & | operator=(QWebSocketHandshakeOptions &&other) |
| ~QWebSocketHandshakeOptions() | |
| void | swap(QWebSocketHandshakeOptions &other) |
| QStringList | subprotocols() const |
| void | setSubprotocols(const QStringList &protocols) |
Detailed Description
Pass the options to QWebSocket::open(). The subprotocols are sent in the Sec-WebSocket-Protocol header, in order of preference; the server chooses one of them, and QWebSocket::subprotocol() returns it.
server.setSupportedSubprotocols({QStringLiteral("echo.v2"), QStringLiteral("echo.v1")});
See also QWebSocket::open() and QWebSocketServer::setSupportedSubprotocols().
Differences from Qt
None.
Member Function Documentation
QWebSocketHandshakeOptions::QWebSocketHandshakeOptions()
Constructs options with no subprotocols.
QWebSocketHandshakeOptions::QWebSocketHandshakeOptions(const QWebSocketHandshakeOptions &other)
Constructs a copy of other.
QWebSocketHandshakeOptions::QWebSocketHandshakeOptions(QWebSocketHandshakeOptions &&other)
Move-constructs options from other.
QWebSocketHandshakeOptions::~QWebSocketHandshakeOptions()
Destroys the options.
QWebSocketHandshakeOptions & QWebSocketHandshakeOptions::operator=(const QWebSocketHandshakeOptions &other)
Assigns other to these options and returns a reference to them.
QWebSocketHandshakeOptions & QWebSocketHandshakeOptions::operator=(QWebSocketHandshakeOptions &&other)
This is an overloaded function.
Move-assigns other to these options and returns a reference to them.
void QWebSocketHandshakeOptions::setSubprotocols(const QStringList &protocols)
Sets the subprotocols to ask for to protocols, in order of preference. Each must be an HTTP token, such as chat.v2.
See also subprotocols().
QStringList QWebSocketHandshakeOptions::subprotocols() const
Returns the subprotocols to ask for.
See also setSubprotocols().
void QWebSocketHandshakeOptions::swap(QWebSocketHandshakeOptions &other)
Swaps these options with other.