17 return HTTPClient::Connect();
23 return HTTPClient::Connect(resolver);
28 _sync_connect =
false;
29 return HTTPClient::ConnectAsync();
34 _sync_connect =
false;
35 return HTTPClient::ConnectAsync(resolver);
95 HTTPClient::onReceived(buffer, size);
107 HTTPClient::onReceivedResponseHeader(response);
118 auto body = response.
body();
123 HTTPClient::onReceivedResponse(response);
131 onError(asio::error::fault,
"WebSocket error", error);
135 HTTPClient::onReceivedResponseError(response, error);
145 std::vector<uint8_t> cache;
153 cache.resize(required);
154 size_t received = HTTPClient::Receive(cache.data(), required);
155 if (received != required)
176 std::vector<uint8_t> cache;
184 cache.resize(required);
185 size_t received = HTTPClient::Receive(cache.data(), required, timeout);
186 if (received != required)
202 std::vector<uint8_t> result;
207 std::vector<uint8_t> cache;
215 cache.resize(required);
216 size_t received = HTTPClient::Receive(cache.data(), required);
217 if (received != required)
233 std::vector<uint8_t> result;
238 std::vector<uint8_t> cache;
246 cache.resize(required);
247 size_t received = HTTPClient::Receive(cache.data(), required, timeout);
248 if (received != required)
virtual size_t Send(const void *buffer, size_t size)
Send data to the server (synchronous).
virtual bool SendAsync(const void *buffer, size_t size)
Send data to the server (asynchronous).
virtual void onError(int error, const std::string &category, const std::string &message)
Handle error notification.
HTTPResponse _response
HTTP response.
HTTPRequest _request
HTTP request.
std::string_view body() const noexcept
Get the HTTP response body.
bool ConnectAsync() override
Connect the client (asynchronous).
std::string ReceiveText()
void onReceivedResponse(const HTTP::HTTPResponse &response) override
Handle HTTP response received notification.
void onReceivedResponseHeader(const HTTP::HTTPResponse &response) override
Handle HTTP response header received notification.
void onDisconnected() override
Handle client disconnected notification.
bool Connect() override
Connect the client (synchronous).
void onReceivedResponseError(const HTTP::HTTPResponse &response, const std::string &error) override
Handle HTTP response error notification.
void onDisconnecting() override
Handle client disconnecting notification.
std::vector< uint8_t > ReceiveBinary()
void onConnected() override
Handle client connected notification.
void onReceived(const void *buffer, size_t size) override
Handle buffer 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.
virtual void onWSDisconnecting()
Handle WebSocket disconnecting notification.
size_t _ws_header_size
Received frame header size.
virtual void onWSDisconnected()
Handle WebSocket disconnected notification.
bool _ws_handshaked
Handshaked flag.
C++ Server project definitions.
WebSocket client definition.