Fix Database

Add WS Header
This commit is contained in:
2022-10-22 01:42:23 +02:00
parent c214d473e2
commit 176c43d5a6
4 changed files with 42 additions and 39 deletions
+2
View File
@@ -33,11 +33,13 @@ namespace gaconnector
ix::WebSocket *webSocket = nullptr;
std::string host;
std::string user;
std::string token;
std::function<void(const std::string)> toLog;
public:
Websocket(std::string host,
std::string user,
std::string token,
std::function<void(const std::string)> toLog);
~Websocket();
void onClientMessageCallback(const ix::WebSocketMessagePtr &msg);
+5 -1
View File
@@ -8,8 +8,9 @@ namespace gaconnector
{
Websocket::Websocket(std::string host,
std::string user,
std::string token,
std::function<void(const std::string)> toLog)
: host(host), user(user), toLog(std::move(toLog))
: host(host), user(user), token(token), toLog(std::move(toLog))
{
#ifdef IBM
// Required on Windows
@@ -17,6 +18,9 @@ namespace gaconnector
#endif
this->webSocket = new ix::WebSocket();
this->webSocket->setExtraHeaders({
{ "Authentication", "Bearer " + this->token }
});
this->webSocket->enableAutomaticReconnection();
this->webSocket->setUrl(host);
this->webSocket->setOnMessageCallback(