diff --git a/src/Init/Heartbeat.cpp b/src/Init/Heartbeat.cpp index a1bb1ab..a097a29 100644 --- a/src/Init/Heartbeat.cpp +++ b/src/Init/Heartbeat.cpp @@ -9,6 +9,7 @@ #include #include +void WebsocketInit(); std::string GetPlayers(){ std::string Return; for(Client* c : CI->Clients){ @@ -31,6 +32,7 @@ std::string GenerateCall(){ void Heartbeat(){ DebugPrintTID(); std::string R,T; + bool isAuth = false; while(true){ R = GenerateCall(); if(!CustomIP.empty())R+="&ip="+CustomIP; @@ -51,6 +53,10 @@ void Heartbeat(){ if(T.length() == 4)info(Sec("Server authenticated")); R.clear(); T.clear(); + if(!isAuth){ + WebsocketInit(); + isAuth = true; + } std::this_thread::sleep_for(std::chrono::seconds(3)); } } diff --git a/src/Init/Startup.cpp b/src/Init/Startup.cpp index cf4f70e..a23c5cd 100644 --- a/src/Init/Startup.cpp +++ b/src/Init/Startup.cpp @@ -9,11 +9,11 @@ std::string CustomIP; std::string GetSVer(){ - static std::string r = Sec("0.64"); + static std::string r = Sec("1.0"); return r; } std::string GetCVer(){ - static std::string r = Sec("1.63"); + static std::string r = Sec("1.70"); return r; } void Args(int argc, char* argv[]){ diff --git a/src/Network/Websocket.cpp b/src/Network/Websocket.cpp new file mode 100644 index 0000000..2a1c2e0 --- /dev/null +++ b/src/Network/Websocket.cpp @@ -0,0 +1,43 @@ +/// +/// Created by Anonymous275 on 11/6/2020 +/// +#include +#include +#include +#include +#include "Security/Enc.h" +#include +#include "Logger.h" +#include +#include + +namespace beast = boost::beast; +namespace http = beast::http; +namespace websocket = beast::websocket; +namespace net = boost::asio; +using tcp = boost::asio::ip::tcp; +//ws.write(asio::buffer("Hello, world!")); +// asio::connect(sock,r.resolve(asio::ip::tcp::resolver::query{host, "80"})); +// beast::websocket::stream ws(sock); +// ws.handshake(host,"/"); +void SyncData(){ + DebugPrintTID(); + using namespace boost; + std::string const host = "95.216.35.232"; + net::io_context ioc; + + tcp::resolver r(ioc); + + websocket::stream ws{ioc}; + auto const results = r.resolve(host, "3600"); + net::connect(ws.next_layer(), results.begin(), results.end()); + + +} + + +void WebsocketInit(){ + std::thread t1(SyncData); + t1.detach(); +} +