50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
#ifndef GERMANAIRLINESVA_GACONNECTOR_WEBSOCKET_WEBSOCKET_H
|
|
#define GERMANAIRLINESVA_GACONNECTOR_WEBSOCKET_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
|
|
{
|
|
namespace gaconnector
|
|
{
|
|
namespace websocket
|
|
{
|
|
class Websocket
|
|
{
|
|
private:
|
|
bool isLoggedIn = false;
|
|
char lastPath[513] = "";
|
|
char lastHash[2 * MD5LEN + 1] = "";
|
|
ix::WebSocket *webSocket = nullptr;
|
|
std::string host;
|
|
std::string user;
|
|
std::function<void(const 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 websocket
|
|
} // namespace gaconnector
|
|
} // namespace germanairlinesva
|
|
|
|
#endif |