From 94725a5086e43f0628d6e0e3e31267101c919aa7 Mon Sep 17 00:00:00 2001 From: trippyone <137233897+trippyone@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:04:24 -0400 Subject: [PATCH] Use different port for websocket connection --- Fika.Core/Networking/FikaServer.cs | 2 +- Fika.Core/Networking/NatPunch/FikaNatPunchClient.cs | 2 +- Fika.Core/Networking/NatPunch/FikaNatPunchServer.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Fika.Core/Networking/FikaServer.cs b/Fika.Core/Networking/FikaServer.cs index eb9ddf00..75d84e3c 100644 --- a/Fika.Core/Networking/FikaServer.cs +++ b/Fika.Core/Networking/FikaServer.cs @@ -110,7 +110,7 @@ public async Task Init() }; var natPunchServer = new FikaNatPunchServer(_netServer); - natPunchServer.Listen(); + natPunchServer.Connect(); if (FikaPlugin.UseUPnP.Value) { diff --git a/Fika.Core/Networking/NatPunch/FikaNatPunchClient.cs b/Fika.Core/Networking/NatPunch/FikaNatPunchClient.cs index 9cf88136..ec8c04b2 100644 --- a/Fika.Core/Networking/NatPunch/FikaNatPunchClient.cs +++ b/Fika.Core/Networking/NatPunch/FikaNatPunchClient.cs @@ -21,7 +21,7 @@ public class FikaNatPunchClient public FikaNatPunchClient() { // Assuming http protocol is always used - Host = RequestHandler.Host.Replace("http", "ws"); + Host = $"{RequestHandler.Host.Replace("http", "ws").Split(':')[0]}:6970"; SessionId = RequestHandler.SessionId; Url = $"{Host}/{SessionId}?"; diff --git a/Fika.Core/Networking/NatPunch/FikaNatPunchServer.cs b/Fika.Core/Networking/NatPunch/FikaNatPunchServer.cs index 59232bff..033ded3f 100644 --- a/Fika.Core/Networking/NatPunch/FikaNatPunchServer.cs +++ b/Fika.Core/Networking/NatPunch/FikaNatPunchServer.cs @@ -22,7 +22,7 @@ public class FikaNatPunchServer public FikaNatPunchServer(NetManager netManager) { // Assuming http protocol is always used - Host = RequestHandler.Host.Replace("http", "ws"); + Host = $"{RequestHandler.Host.Replace("http", "ws").Split(':')[0]}:6970"; SessionId = RequestHandler.SessionId; Url = $"{Host}/{SessionId}?"; @@ -41,7 +41,7 @@ public FikaNatPunchServer(NetManager netManager) StunIpEndPoint = NatPunchUtils.CreateStunEndPoint(FikaPlugin.UDPPort.Value); } - public void Listen() + public void Connect() { _webSocket.Connect(); }