camcom 1.0.0-pre2
 
Loading...
Searching...
No Matches
camcom::test::WebSocketClient Class Reference

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
 

Detailed Description

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.

Member Typedef Documentation

◆ FrameCallback

using camcom::test::WebSocketClient::FrameCallback = std::function<void(const std::vector<uint8_t>&, bool)>

Constructor & Destructor Documentation

◆ WebSocketClient()

camcom::test::WebSocketClient::WebSocketClient ( )

◆ ~WebSocketClient()

camcom::test::WebSocketClient::~WebSocketClient ( )

Member Function Documentation

◆ clearReceivedFrames()

void camcom::test::WebSocketClient::clearReceivedFrames ( )

◆ connect()

bool camcom::test::WebSocketClient::connect ( const std::string & host,
int port,
const std::string & path = "/ws" )

◆ disconnect()

void camcom::test::WebSocketClient::disconnect ( )

◆ getBytesReceived()

size_t camcom::test::WebSocketClient::getBytesReceived ( ) const

◆ getFramesReceived()

size_t camcom::test::WebSocketClient::getFramesReceived ( ) const

◆ getLastError()

std::string camcom::test::WebSocketClient::getLastError ( ) const

◆ getReceivedFrames()

std::vector< std::vector< uint8_t > > camcom::test::WebSocketClient::getReceivedFrames ( )

◆ isConnected()

bool camcom::test::WebSocketClient::isConnected ( ) const

◆ receive()

bool camcom::test::WebSocketClient::receive ( std::vector< uint8_t > & data,
int timeout_ms = 1000 )

◆ send()

bool camcom::test::WebSocketClient::send ( const std::vector< uint8_t > & data)

◆ sendText()

bool camcom::test::WebSocketClient::sendText ( const std::string & text)

◆ setFrameCallback()

void camcom::test::WebSocketClient::setFrameCallback ( FrameCallback callback)

◆ startReceiveLoop()

void camcom::test::WebSocketClient::startReceiveLoop ( )

◆ stopReceiveLoop()

void camcom::test::WebSocketClient::stopReceiveLoop ( )

The documentation for this class was generated from the following files: