Simple WebSocket client for testing. More...
#include <websocket_client.hpp>
Classes | |
| struct | Impl |
Public Types | |
| using | FrameCallback = std::function<void(const std::vector<uint8_t>&, bool)> |
Public Member Functions | |
| WebSocketClient () | |
| ~WebSocketClient () | |
| bool | connect (const std::string &host, int port, const std::string &path="/ws") |
| void | disconnect () |
| bool | isConnected () const |
| bool | send (const std::vector< uint8_t > &data) |
| bool | sendText (const std::string &text) |
| bool | receive (std::vector< uint8_t > &data, int timeout_ms=1000) |
| void | setFrameCallback (FrameCallback callback) |
| void | startReceiveLoop () |
| void | stopReceiveLoop () |
| std::vector< std::vector< uint8_t > > | getReceivedFrames () |
| void | clearReceivedFrames () |
| size_t | getFramesReceived () const |
| size_t | getBytesReceived () const |
| std::string | getLastError () const |
Simple WebSocket client for testing.
This is a minimal WebSocket client implementation for testing purposes. It handles the WebSocket handshake and frame parsing.
Note: This is a test-only implementation, not a full WebSocket library.
| using camcom::test::WebSocketClient::FrameCallback = std::function<void(const std::vector<uint8_t>&, bool)> |
| camcom::test::WebSocketClient::WebSocketClient | ( | ) |
| camcom::test::WebSocketClient::~WebSocketClient | ( | ) |
| void camcom::test::WebSocketClient::clearReceivedFrames | ( | ) |
| bool camcom::test::WebSocketClient::connect | ( | const std::string & | host, |
| int | port, | ||
| const std::string & | path = "/ws" ) |
| void camcom::test::WebSocketClient::disconnect | ( | ) |
| size_t camcom::test::WebSocketClient::getBytesReceived | ( | ) | const |
| size_t camcom::test::WebSocketClient::getFramesReceived | ( | ) | const |
| std::string camcom::test::WebSocketClient::getLastError | ( | ) | const |
| std::vector< std::vector< uint8_t > > camcom::test::WebSocketClient::getReceivedFrames | ( | ) |
| bool camcom::test::WebSocketClient::isConnected | ( | ) | const |
| bool camcom::test::WebSocketClient::receive | ( | std::vector< uint8_t > & | data, |
| int | timeout_ms = 1000 ) |
| bool camcom::test::WebSocketClient::send | ( | const std::vector< uint8_t > & | data | ) |
| bool camcom::test::WebSocketClient::sendText | ( | const std::string & | text | ) |
| void camcom::test::WebSocketClient::setFrameCallback | ( | FrameCallback | callback | ) |
| void camcom::test::WebSocketClient::startReceiveLoop | ( | ) |
| void camcom::test::WebSocketClient::stopReceiveLoop | ( | ) |