#ifndef WEBCLIENT_H #define WEBCLIENT_H #pragma once #include #include #include #include #include namespace beast = boost::beast; // from namespace http = beast::http; // from namespace websocket = beast::websocket; // from namespace net = boost::asio; // from using tcp = boost::asio::ip::tcp; // from namespace ANSCENTER { class WebSocketClient { public: WebSocketClient(std::string host, std::string port, std::string url); ~WebSocketClient(); std::string Send(std::string s); private: net::io_context m_ioc; // The io_context is required for all I/O websocket::stream m_ws{ m_ioc }; // perform our I/O beast::flat_buffer m_buffer; }; class HttpClient { public: HttpClient(std::string host, std::string port, std::string url); ~HttpClient(); std::string Send(std::string s); private: net::io_context m_ioc; // The io_context is required for all I/O beast::tcp_stream m_stream{ m_ioc }; // perform our I/O beast::flat_buffer m_buffer; http::request m_req; http::response m_res; tcp::resolver::results_type m_results; }; } #endif