Kurlyk
Loading...
Searching...
No Matches
IWebSocketSender.hpp
Go to the documentation of this file.
1#pragma once
2#ifndef _KURLYK_IWEBSOCKET_SENDER_HPP_INCLUDED
3#define _KURLYK_IWEBSOCKET_SENDER_HPP_INCLUDED
4
7
8namespace kurlyk {
9
13 public:
14
16 IWebSocketSender() = default;
17
19 virtual ~IWebSocketSender() = default;
20
23 virtual std::string get_http_version() = 0;
24
27 virtual Headers get_headers() = 0;
28
31 virtual std::string get_remote_endpoint() = 0;
32
38 virtual bool send_message(
39 const std::string &message,
40 long rate_limit_id = 0,
41 std::function<void(const std::error_code&)> callback = nullptr) = 0;
42
48 virtual bool send_close(
49 int status = 1000,
50 const std::string &reason = std::string(),
51 std::function<void(const std::error_code&)> callback = nullptr) = 0;
52
55 virtual bool is_connected() const = 0;
56
57 };
58
60 using WebSocketSenderPtr = std::shared_ptr<IWebSocketSender>;
61
62} // namespace kurlyk
63
64#endif // _KURLYK_IWEBSOCKET_SENDER_HPP_INCLUDED
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 Headers get_headers()=0
Retrieves the headers associated with the WebSocket connection.
IWebSocketSender()=default
Default constructor for IWebSocketSender.
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 ~IWebSocketSender()=default
Virtual destructor for IWebSocketSender.
virtual bool is_connected() const =0
Checks if the WebSocket connection is currently active.
virtual std::string get_remote_endpoint()=0
Retrieves the remote endpoint information.
virtual std::string get_http_version()=0
Retrieves the HTTP version used in the WebSocket connection.
Primary namespace for the Kurlyk library, encompassing initialization, request management,...
utils::CaseInsensitiveMultimap Headers
Alias for HTTP headers, providing a case-insensitive unordered multimap.
std::shared_ptr< IWebSocketSender > WebSocketSenderPtr
Alias for a shared pointer to an IWebSocketSender instance.