2022-09-08 02:02:09 +02:00

43 lines
959 B
C++

#ifndef GERMANAIRLINESVA_GACONNECTOR_WEBSOCKET_H
#define GERMANAIRLINESVA_GACONNECTOR_WEBSOCKET_H
#define BUFSIZE 1024
#define MD5LEN 16
#include <IXNetSystem.h>
#include <IXWebSocketServer.h>
#include <json.hpp>
#include "types.h"
#include "util.hpp"
#include <functional>
#include <iostream>
#include <sstream>
#include <string>
#include <utility>
namespace germanairlinesva_websocket
{
class Websocket
{
private:
char lastPath[513] = "";
char lastHash[2 * MD5LEN + 1] = "";
ix::WebSocket *webSocket = nullptr;
std::string host;
std::string user;
std::function<void(std::string)> toLog;
public:
Websocket(std::string host,
std::string user,
std::function<void(const std::string)> toLog);
~Websocket();
void onClientMessageCallback(const ix::WebSocketMessagePtr &msg);
void sendData(data &d);
};
} // namespace germanairlinesva_websocket
#endif