mirror of
https://github.com/falk-werner/webfuse
synced 2024-10-27 20:34:10 +00:00
39 lines
767 B
C++
39 lines
767 B
C++
#ifndef WF_TEST_UTIL_WS_SERVER2_HPP
|
|
#define WF_TEST_UTIL_WS_SERVER2_HPP
|
|
|
|
#include <jansson.h>
|
|
#include <string>
|
|
|
|
namespace webfuse_test
|
|
{
|
|
|
|
class IIvokationHandler
|
|
{
|
|
public:
|
|
virtual ~IIvokationHandler() = default;
|
|
virtual std::string Invoke(char const * method, json_t * params) = 0;
|
|
};
|
|
|
|
class WsServer
|
|
{
|
|
WsServer(WsServer const &) = delete;
|
|
WsServer & operator=(WsServer const & ) = delete;
|
|
public:
|
|
WsServer(
|
|
IIvokationHandler& handler,
|
|
std::string const & protocol,
|
|
int port = 0,
|
|
bool enable_tls = false);
|
|
virtual ~WsServer();
|
|
std::string const & GetUrl() const;
|
|
void SendMessage(char const * message);
|
|
void SendMessage(json_t * message);
|
|
private:
|
|
class Private;
|
|
Private * d;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|