Interface for a WebSocket sender, offering methods to send messages, close connections, and check connection status.
More...
#include <IWebSocketSender.hpp>
|
| | IWebSocketSender ()=default |
| | Default constructor for IWebSocketSender.
|
| |
| virtual | ~IWebSocketSender ()=default |
| | Virtual destructor for IWebSocketSender.
|
| |
| virtual std::string | get_http_version ()=0 |
| | Retrieves the HTTP version used in the WebSocket connection.
|
| |
| virtual Headers | get_headers ()=0 |
| | Retrieves the headers associated with the WebSocket connection.
|
| |
| virtual std::string | get_remote_endpoint ()=0 |
| | Retrieves the remote endpoint information.
|
| |
| virtual bool | send_message (const std::string &message, long rate_limit_id=0, std::function< void(const std::error_code &)> callback=nullptr)=0 |
| | Sends a WebSocket message.
|
| |
| virtual bool | send_close (int status=1000, const std::string &reason=std::string(), std::function< void(const std::error_code &)> callback=nullptr)=0 |
| | Sends a close request to the WebSocket server.
|
| |
| virtual bool | is_connected () const =0 |
| | Checks if the WebSocket connection is currently active.
|
| |
Interface for a WebSocket sender, offering methods to send messages, close connections, and check connection status.
Definition at line 12 of file IWebSocketSender.hpp.
◆ IWebSocketSender()
| kurlyk::IWebSocketSender::IWebSocketSender |
( |
| ) |
|
|
default |
◆ ~IWebSocketSender()
| virtual kurlyk::IWebSocketSender::~IWebSocketSender |
( |
| ) |
|
|
virtualdefault |
◆ get_headers()
| virtual Headers kurlyk::IWebSocketSender::get_headers |
( |
| ) |
|
|
pure virtual |
◆ get_http_version()
| virtual std::string kurlyk::IWebSocketSender::get_http_version |
( |
| ) |
|
|
pure virtual |
◆ get_remote_endpoint()
| virtual std::string kurlyk::IWebSocketSender::get_remote_endpoint |
( |
| ) |
|
|
pure virtual |
◆ is_connected()
| virtual bool kurlyk::IWebSocketSender::is_connected |
( |
| ) |
const |
|
pure virtual |
Checks if the WebSocket connection is currently active.
- Returns
- True if the WebSocket is connected, false otherwise.
Implemented in kurlyk::BaseWebSocketClient.
◆ send_close()
| virtual bool kurlyk::IWebSocketSender::send_close |
( |
int | status = 1000, |
|
|
const std::string & | reason = std::string(), |
|
|
std::function< void(const std::error_code &)> | callback = nullptr ) |
|
pure virtual |
Sends a close request to the WebSocket server.
- Parameters
-
| status | The status code for the close request, default is 1000 (normal closure). |
| reason | Optional reason for closing the connection. |
| callback | Optional callback to execute once the close request is sent, providing an error code if any issues occur. |
- Returns
- True if the close request was accepted, false otherwise.
◆ send_message()
| virtual bool kurlyk::IWebSocketSender::send_message |
( |
const std::string & | message, |
|
|
long | rate_limit_id = 0, |
|
|
std::function< void(const std::error_code &)> | callback = nullptr ) |
|
pure virtual |
Sends a WebSocket message.
- Parameters
-
| message | The content of the message to be sent. |
| rate_limit_id | The ID of the rate limit to apply to this message. A value of 0 indicates the default or no rate limit. |
| callback | Optional callback to execute once the message is sent, providing an error code if any issues occur. |
- Returns
- True if the message was accepted for sending, false otherwise.
The documentation for this class was generated from the following file: