17 return HTTPSClient::Connect();
23 return HTTPSClient::Connect(resolver);
28 _sync_connect =
false;
29 return HTTPSClient::ConnectAsync();
34 _sync_connect =
false;
35 return HTTPSClient::ConnectAsync(resolver);
86 HTTPSClient::onReceived(buffer, size);
98 HTTPSClient::onReceivedResponseHeader(response);
109 auto body = response.
body();
114 HTTPSClient::onReceivedResponse(response);
122 onError(asio::error::fault,
"WebSocket error", error);
126 HTTPSClient::onReceivedResponseError(response, error);
136 std::vector<uint8_t> cache;
144 cache.resize(required);
145 size_t received = HTTPSClient::Receive(cache.data(), required);
146 if (received != required)
167 std::vector<uint8_t> cache;
175 cache.resize(required);
176 size_t received = HTTPSClient::Receive(cache.data(), required, timeout);
177 if (received != required)
193 std::vector<uint8_t> result;
198 std::vector<uint8_t> cache;
206 cache.resize(required);
207 size_t received = HTTPSClient::Receive(cache.data(), required);
208 if (received != required)
224 std::vector<uint8_t> result;
229 std::vector<uint8_t> cache;
237 cache.resize(required);
238 size_t received = HTTPSClient::Receive(cache.data(), required, timeout);
239 if (received != required)
virtual size_t Send(const void *buffer, size_t size)
Send data to the server (synchronous)
virtual void onError(int error, const std::string &category, const std::string &message)
Handle error notification.
virtual bool SendAsync(const void *buffer, size_t size)
Send data to the server (asynchronous)
HTTPRequest & SetBody(std::string_view body="")
Set the HTTP request body.
const std::string & cache() const noexcept
Get the HTTP request cache content.
HTTPRequest & Clear()
Clear the HTTP request cache.
HTTPResponse & Clear()
Clear the HTTP response cache.
std::string_view body() const noexcept
Get the HTTP response body.
HTTPResponse _response
HTTP response.
HTTPRequest _request
HTTP request.
std::vector< uint8_t > ReceiveBinary()
void onReceivedResponse(const HTTP::HTTPResponse &response) override
Handle HTTP response received notification.
bool ConnectAsync() override
Connect the client (asynchronous)
void onReceivedResponseError(const HTTP::HTTPResponse &response, const std::string &error) override
Handle HTTP response error notification.
void onReceived(const void *buffer, size_t size) override
Handle buffer received notification.
bool Connect() override
Connect the client (synchronous)
std::string ReceiveText()
void onHandshaked() override
Handle session handshaked notification.
void onDisconnected() override
Handle client disconnected notification.
void onReceivedResponseHeader(const HTTP::HTTPResponse &response) override
Handle HTTP response header received notification.
size_t _ws_payload_size
Received frame payload size.
bool _ws_frame_received
Received frame flag.
void InitWSNonce()
Initialize WebSocket random nonce.
void PrepareReceiveFrame(const void *buffer, size_t size)
Prepare WebSocket receive frame.
virtual void onWSConnecting(HTTP::HTTPRequest &request)
Handle WebSocket client connecting notification.
std::vector< uint8_t > _ws_receive_final_buffer
Receive final buffer.
bool PerformClientUpgrade(const HTTP::HTTPResponse &response, const CppCommon::UUID &id)
Perform WebSocket client upgrade.
void ClearWSBuffers()
Clear WebSocket send/receive buffers.
size_t RequiredReceiveFrameSize()
Required WebSocket receive frame size.
bool _ws_final_received
Received final flag.
size_t _ws_header_size
Received frame header size.
virtual void onWSDisconnected()
Handle WebSocket client disconnected notification.
bool _ws_handshaked
Handshaked flag.
C++ Server project definitions.
WebSocket secure client definition.