Builder for WebSocket connections.
More...
#include <WsConnection.hpp>
Builder for WebSocket connections.
◆ WsConnectionBuilder()
util::requests::WsConnectionBuilder::WsConnectionBuilder |
( |
std::string | host, |
|
|
std::string | port ) |
Create a new connection builder.
- Parameters
-
host | Host to connect to |
port | Port to connect to |
◆ addHeader()
Add a header to the request.
- Parameters
-
- Returns
- Reference to self
◆ addHeaders()
Add multiple headers to the request.
- Parameters
-
- Returns
- Reference to self
◆ connect()
std::expected< WsConnectionPtr, RequestError > util::requests::WsConnectionBuilder::connect |
( |
boost::asio::yield_context | yield | ) |
const |
Connect to the host trying SSL first then plain if SSL fails.
- Parameters
-
- Returns
- WebSocket connection or error
◆ connectImpl()
template<typename StreamDataType >
std::expected< WsConnectionPtr, RequestError > util::requests::WsConnectionBuilder::connectImpl |
( |
StreamDataType && | streamData, |
|
|
asio::yield_context | yield ) const |
Connect to the host using web socket asynchronously.
- Template Parameters
-
StreamDataType | The type of the stream data |
- Parameters
-
streamData | The stream data |
yield | The coroutine context |
- Returns
- WebSocket connection or error
◆ plainConnect()
std::expected< WsConnectionPtr, RequestError > util::requests::WsConnectionBuilder::plainConnect |
( |
boost::asio::yield_context | yield | ) |
const |
Connect to the host without SSL asynchronously.
- Parameters
-
- Returns
- WebSocket connection or error
◆ setConnectionTimeout()
WsConnectionBuilder & util::requests::WsConnectionBuilder::setConnectionTimeout |
( |
std::chrono::steady_clock::duration | timeout | ) |
|
Set the timeout for connection establishing operations. Default is 5 seconds.
- Parameters
-
- Returns
- Reference to self
◆ setTarget()
Set the target of the request.
- Parameters
-
- Returns
- Reference to self
◆ setWsHandshakeTimeout()
WsConnectionBuilder & util::requests::WsConnectionBuilder::setWsHandshakeTimeout |
( |
std::chrono::steady_clock::duration | timeout | ) |
|
Set the timeout for WebSocket handshake. Default is 5 seconds.
- Parameters
-
- Returns
- Reference to self
◆ sslConnect()
std::expected< WsConnectionPtr, RequestError > util::requests::WsConnectionBuilder::sslConnect |
( |
boost::asio::yield_context | yield | ) |
const |
Connect to the host using SSL asynchronously.
- Parameters
-
- Returns
- WebSocket connection or error
◆ kDEFAULT_TIMEOUT
std::chrono::seconds util::requests::WsConnectionBuilder::kDEFAULT_TIMEOUT {5} |
|
staticconstexpr |
Default timeout for connecting
The documentation for this class was generated from the following files:
- /__w/clio/clio/src/util/requests/WsConnection.hpp
- /__w/clio/clio/src/util/requests/WsConnection.cpp