88 * establishing and managing connections, making requests, and handling responses.
99 */
1010
11- #include < boost/asio.hpp>
12- #include < boost/asio/cancellation_signal.hpp>
11+ #include " IConnection.hpp"
1312#include < boost/beast.hpp>
1413#include < boost/beast/websocket/ssl.hpp>
15- #include < boost/json.hpp>
16- #include < boost/url.hpp>
1714#include < chrono>
1815#include < string>
1916
@@ -29,7 +26,7 @@ namespace internals
2926 * The Connection class encapsulates the functionality for establishing an SSL connection,
3027 * sending requests, and receiving responses.
3128 */
32- class Connection
29+ class Connection : public IConnection
3330{
3431 public:
3532 Connection () = delete ;
@@ -47,42 +44,41 @@ class Connection
4744 */
4845 explicit Connection (boost::asio::io_context &ioContext);
4946
50- virtual ~Connection ();
47+ virtual ~Connection () override ;
5148
5249 /* *
5350 * @brief Asynchronously establishes secure WebSocket connection to the server.
5451 * @param url The URL to connect to.
5552 * @return An awaitable void.
5653 * @throw xapi::exception::ConnectionClosed if the connection fails.
5754 */
58- boost::asio::awaitable<void > connect (const boost::url &url);
55+ boost::asio::awaitable<void > connect (const boost::url &url) override ;
5956
6057 /* *
6158 * @brief Asynchronously disconnects from the server.
6259 * @return An awaitable void.
6360 */
64- boost::asio::awaitable<void > disconnect ();
61+ boost::asio::awaitable<void > disconnect () override ;
6562
6663 /* *
6764 * @brief Makes an asynchronous request to the server.
6865 * @param command The command to send as a JSON value.
6966 * @return An awaitable void.
7067 * @throw xapi::exception::ConnectionClosed if the request fails.
7168 */
72- boost::asio::awaitable<void > makeRequest (const boost::json::object &command);
69+ boost::asio::awaitable<void > makeRequest (const boost::json::object &command) override ;
7370
7471 /* *
7572 * @brief Waits for a response from the server.
7673 * @return An awaitable boost::json::object with response from the server.
7774 * @throw xapi::exception::ConnectionClosed if the response fails.
7875 */
79- boost::asio::awaitable<boost::json::object> waitResponse ();
76+ boost::asio::awaitable<boost::json::object> waitResponse () override ;
8077
81- protected :
78+ private :
8279 // The IO context for asynchronous operations.
8380 boost::asio::io_context &m_ioContext;
8481
85- private:
8682 /* *
8783 * @brief Establishes an SSL connection asynchronously.
8884 * @param results The resolved endpoints to attempt to connect to.
0 commit comments