QWebSocketHandshakeOptions Class | Qt WebSockets | Qt 6.12.0
Description: Collects options for the WebSocket handshake.
Keywords: class

- Qt 6.12
- Qt WebSockets
- C++ Classes
- QWebSocketHandshakeOptions
- Qt 6.12.0 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(const QWebSocketHandshakeOptions &other)
| QWebSocketHandshakeOptions(QWebSocketHandshakeOptions &&other)
| ~QWebSocketHandshakeOptions()
void | setSubprotocols(const QStringList &protocols)
QStringList | subprotocols() const
QWebSocketHandshakeOptions & | operator=(QWebSocketHandshakeOptions &&other)
QWebSocketHandshakeOptions & | operator=(const QWebSocketHandshakeOptions &other)

## 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()

Constructs an empty QWebSocketHandshakeOptions object.

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

Constructs a QWebSocketHandshakeOptions that is a copy of other.

### `[constexpr noexcept default]` QWebSocketHandshakeOptions::QWebSocketHandshakeOptions(QWebSocketHandshakeOptions &&other)

Constructs a QWebSocketHandshakeOptions that is moved from other.

### `[noexcept]` 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().

### `[noexcept]` QWebSocketHandshakeOptions &QWebSocketHandshakeOptions::operator=(QWebSocketHandshakeOptions &&other)

Moves other to this object.

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

Assigns other to this object.

## 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.