QWebSocketHandshakeOptions Class | Qt WebSockets 6.4.1

- Qt 6.4
- Qt WebSockets
- C++ Classes
- QWebSocketHandshakeOptions
- Qt 6.4.1 Reference Documentation

# QWebSocketHandshakeOptions Class

Collects options for the WebSocket handshake. More...

Header: | #include <QWebSocketHandshakeOptions>
CMake: | find_package(Qt6 REQUIRED COMPONENTS WebSockets) target_link_libraries(mytarget PRIVATE Qt6::WebSockets)
qmake: | QT += websockets
Since: | Qt 6.4

- List of all members, including inherited members

## Public Functions

| QWebSocketHandshakeOptions(QWebSocketHandshakeOptions &&other)
| QWebSocketHandshakeOptions(const QWebSocketHandshakeOptions &other)
| QWebSocketHandshakeOptions()
QWebSocketHandshakeOptions & | operator=(const QWebSocketHandshakeOptions &other)
QWebSocketHandshakeOptions & | operator=(QWebSocketHandshakeOptions &&other)
| ~QWebSocketHandshakeOptions()
void | setSubprotocols(const QStringList &protocols)
QStringList | subprotocols() const

## Related Non-Members

bool | operator!=(const QWebSocketHandshakeOptions &lhs, const QWebSocketHandshakeOptions &rhs)
bool | operator==(const QWebSocketHandshakeOptions &lhs, const QWebSocketHandshakeOptions &rhs)

## Detailed Description

QWebSocketHandshakeOptions collects options that are passed along to the WebSocket handshake, such as WebSocket subprotocols and WebSocket Extensions.

At the moment, only WebSocket subprotocols are supported.

See also QWebSocket::open().

## Member Function Documentation

### QWebSocketHandshakeOptions::QWebSocketHandshakeOptions(QWebSocketHandshakeOptions &&other)

Constructs a QWebSocketHandshakeOptions that is moved from other.

### QWebSocketHandshakeOptions::QWebSocketHandshakeOptions(const QWebSocketHandshakeOptions &other)

Constructs a QWebSocketHandshakeOptions that is a copy of other.

### QWebSocketHandshakeOptions::QWebSocketHandshakeOptions()

Constructs an empty QWebSocketHandshakeOptions object.

### QWebSocketHandshakeOptions &QWebSocketHandshakeOptions::operator=(const QWebSocketHandshakeOptions &other)

Assigns other to this object.

### QWebSocketHandshakeOptions &QWebSocketHandshakeOptions::operator=(QWebSocketHandshakeOptions &&other)

Moves other to this object.

### QWebSocketHandshakeOptions::~QWebSocketHandshakeOptions()

Destroys this object.

### void QWebSocketHandshakeOptions::setSubprotocols(const QStringList &protocols)

Sets the list of WebSocket subprotocols protocols to send along with the websocket handshake.

WebSocket subprotocol names may only consist of those US-ASCII characters that are in the unreserved group. Invalid protocol names will not be included in the handshake.

See also subprotocols().

### QStringList QWebSocketHandshakeOptions::subprotocols() const

Returns the list of WebSocket subprotocols to send along with the websocket handshake.

See also setSubprotocols().

## Related Non-Members

### bool operator!=(const QWebSocketHandshakeOptions &lhs, const QWebSocketHandshakeOptions &rhs)

### bool operator==(const QWebSocketHandshakeOptions &lhs, const QWebSocketHandshakeOptions &rhs)

Compares lhs for equality with rhs.