Use HTTPS, support for HTTP missing

This commit is contained in:
badaix 2024-05-07 22:50:27 +02:00
parent f7bd5e733f
commit a796bb2032
14 changed files with 121 additions and 54 deletions

View file

@ -34,6 +34,7 @@
#endif
#include <boost/beast/core.hpp>
#pragma GCC diagnostic pop
#include <boost/beast/ssl.hpp>
#include <boost/beast/websocket.hpp>
// standard headers
@ -42,6 +43,8 @@
namespace beast = boost::beast; // from <boost/beast.hpp>
namespace websocket = beast::websocket; // from <boost/beast/websocket.hpp>
using tcp_socket = boost::asio::ip::tcp::socket;
using ssl_socket = boost::asio::ssl::stream<tcp_socket>;
/// Endpoint for a connected control client.
@ -54,7 +57,7 @@ class ControlSessionWebsocket : public ControlSession
{
public:
/// ctor. Received message from the client are passed to ControlMessageReceiver
ControlSessionWebsocket(ControlMessageReceiver* receiver, websocket::stream<beast::tcp_stream>&& socket);
ControlSessionWebsocket(ControlMessageReceiver* receiver, websocket::stream<ssl_socket>&& wss);
~ControlSessionWebsocket() override;
void start() override;
void stop() override;
@ -68,7 +71,7 @@ protected:
void do_read_ws();
void send_next();
websocket::stream<beast::tcp_stream> ws_;
websocket::stream<ssl_socket> wss_;
protected:
beast::flat_buffer buffer_;