Fix Database
Add WS Header
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user