2022-12-30 18:44:55 +00:00
|
|
|
#ifndef WEBFUSE_WSCLIENT_HPP
|
|
|
|
#define WEBFUSE_WSCLIENT_HPP
|
|
|
|
|
|
|
|
#include "webfuse/ws/messagewriter.hpp"
|
|
|
|
#include "webfuse/ws/messagereader.hpp"
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
namespace webfuse
|
|
|
|
{
|
|
|
|
|
|
|
|
using ws_client_handler = std::function<messagewriter (messagereader & reader)>;
|
|
|
|
|
|
|
|
class ws_client
|
|
|
|
{
|
|
|
|
ws_client(ws_client const &) = delete;
|
|
|
|
ws_client& operator=(ws_client const &) = delete;
|
|
|
|
public:
|
2023-01-14 22:58:22 +00:00
|
|
|
ws_client(std::string const & ca_path, ws_client_handler handler);
|
2022-12-30 18:44:55 +00:00
|
|
|
~ws_client();
|
|
|
|
ws_client(ws_client && other);
|
|
|
|
ws_client& operator=(ws_client && other);
|
|
|
|
|
2022-12-30 22:06:47 +00:00
|
|
|
void set_connection_listener(std::function<void(bool)> listener);
|
2022-12-30 18:44:55 +00:00
|
|
|
void connect(std::string url);
|
|
|
|
void service();
|
2022-12-30 22:06:47 +00:00
|
|
|
void interrupt();
|
2022-12-30 18:44:55 +00:00
|
|
|
private:
|
|
|
|
class detail;
|
|
|
|
detail * d;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|