Added websocket

This commit is contained in:
Vladislav Khorev 2026-02-22 13:29:06 +03:00
parent 22ee99418d
commit 7693237aa5
2 changed files with 4 additions and 2 deletions

View File

@ -469,7 +469,7 @@ namespace ZL
#ifdef NETWORK #ifdef NETWORK
#ifdef EMSCRIPTEN #ifdef EMSCRIPTEN
networkClient = std::make_unique<WebSocketClientEmscripten>(); networkClient = std::make_unique<WebSocketClientEmscripten>();
networkClient->Connect("localhost", 8081); networkClient->Connect("192.168.131.143", 8081);
#else #else
networkClient = std::make_unique<WebSocketClient>(taskManager.getIOContext()); networkClient = std::make_unique<WebSocketClient>(taskManager.getIOContext());
networkClient->Connect("127.0.0.1", 8081); networkClient->Connect("127.0.0.1", 8081);
@ -480,6 +480,7 @@ namespace ZL
#endif #endif
} }
void Game::drawCubemap(float skyPercent) void Game::drawCubemap(float skyPercent)
{ {
static const std::string defaultShaderName = "default"; static const std::string defaultShaderName = "default";

View File

@ -7,7 +7,8 @@
namespace ZL { namespace ZL {
void WebSocketClientEmscripten::Connect(const std::string& host, uint16_t port) { void WebSocketClientEmscripten::Connect(const std::string& host, uint16_t port) {
// Формируем URL. Обратите внимание, что в Web часто лучше использовать ws://localhost // Формируем URL. Обратите внимание, что в Web часто лучше использовать ws://localhost
std::string url = "ws://" + host + ":" + std::to_string(port); //std::string url = "ws://" + host + ":" + std::to_string(port);
std::string url = "wss://api.spacegame.fishrungames.com";
EmscriptenWebSocketCreateAttributes attr = { EmscriptenWebSocketCreateAttributes attr = {
url.c_str(), url.c_str(),