16 : HTTP::HTTPSession(server)
50 HTTPSession::onReceived(buffer, size);
62 HTTPSession::onReceivedRequestHeader(request);
78 HTTPSession::onReceivedRequest(request);
86 onError(asio::error::fault,
"WebSocket error", error);
90 HTTPSession::onReceivedRequestError(request, error);
100 std::vector<uint8_t>
cache;
108 cache.resize(required);
109 size_t received = HTTPSession::Receive(
cache.data(), required);
110 if (received != required)
131 std::vector<uint8_t>
cache;
139 cache.resize(required);
140 size_t received = HTTPSession::Receive(
cache.data(), required, timeout);
141 if (received != required)
157 std::vector<uint8_t> result;
162 std::vector<uint8_t>
cache;
170 cache.resize(required);
171 size_t received = HTTPSession::Receive(
cache.data(), required);
172 if (received != required)
188 std::vector<uint8_t> result;
193 std::vector<uint8_t>
cache;
201 cache.resize(required);
202 size_t received = HTTPSession::Receive(
cache.data(), required, timeout);
203 if (received != required)
virtual void onError(int error, const std::string &category, const std::string &message)
Handle error notification.
HTTPRequest & Clear()
Clear the HTTP request cache.
std::string_view body() const noexcept
Get the HTTP request body.
HTTPResponse & Clear()
Clear the HTTP response cache.
HTTPRequest _request
HTTP request.
HTTPResponse & response() noexcept
Get the HTTP response.
HTTPResponse _response
HTTP response.
CppCommon::FileCache & cache() noexcept
Get the static content cache.
void onReceived(const void *buffer, size_t size) override
Handle buffer received notification.
std::vector< uint8_t > ReceiveBinary()
void onReceivedRequest(const HTTP::HTTPRequest &request) override
Handle HTTP request received notification.
void onReceivedRequestHeader(const HTTP::HTTPRequest &request) override
Handle HTTP request header received notification.
void onReceivedRequestError(const HTTP::HTTPRequest &request, const std::string &error) override
Handle HTTP request error notification.
void onDisconnected() override
Handle session disconnected notification.
WSSession(const std::shared_ptr< WSServer > &server)
std::string ReceiveText()
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.
std::vector< uint8_t > _ws_receive_final_buffer
Receive final buffer.
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 PerformServerUpgrade(const HTTP::HTTPRequest &request, HTTP::HTTPResponse &response)
Perform WebSocket server upgrade.
bool _ws_handshaked
Handshaked flag.
C++ Server project definitions.
WebSocket server definition.
WebSocket session definition.