James-Frowen/SimpleWebTransport

dedicated server outside unity using C# console

Closed this issue · 7 comments

image
Here's an example of how the progress is going, but after connecting, it disconnects

[SimpleWebTransport] ERROR: [SimpleWebTransport] Connection closed before handshake
UnityEngine.Logger:Log (UnityEngine.LogType,object)
Mirror.SimpleWeb.Log:Error (string,bool) (at ./Library/PackageCache/com.james-frowen.simplewebtransport@1.6.4/Runtime/Common/Log.cs:93)
Mirror.SimpleWeb.ClientHandshake:TryHandshake (Mirror.SimpleWeb.Connection,System.Uri) (at ./Library/PackageCache/com.james-frowen.simplewebtransport@1.6.4/Runtime/Client/StandAlone/ClientHandshake.cs:53)
Mirror.SimpleWeb.WebSocketClientStandAlone:ConnectAndReceiveLoop (System.Uri) (at ./Library/PackageCache/com.james-frowen.simplewebtransport@1.6.4/Runtime/Client/StandAlone/WebSocketClientStandAlone.cs:68)
Mirror.SimpleWeb.WebSocketClientStandAlone/<>c__DisplayClass5_0:b__0 () (at ./Library/PackageCache/com.james-frowen.simplewebtransport@1.6.4/Runtime/Client/StandAlone/WebSocketClientStandAlone.cs:36)
System.Threading.ThreadHelper:ThreadStart ()

[SimpleWebTransport] WARN: [SimpleWebTransport] Failed Handshake with ws://localhost:7778/
UnityEngine.Logger:Log (UnityEngine.LogType,object)
Mirror.SimpleWeb.Log:Warn (string,bool) (at ./Library/PackageCache/com.james-frowen.simplewebtransport@1.6.4/Runtime/Common/Log.cs:82)
Mirror.SimpleWeb.WebSocketClientStandAlone:ConnectAndReceiveLoop (System.Uri) (at ./Library/PackageCache/com.james-frowen.simplewebtransport@1.6.4/Runtime/Client/StandAlone/WebSocketClientStandAlone.cs:71)
Mirror.SimpleWeb.WebSocketClientStandAlone/<>c__DisplayClass5_0:b__0 () (at ./Library/PackageCache/com.james-frowen.simplewebtransport@1.6.4/Runtime/Client/StandAlone/WebSocketClientStandAlone.cs:36)
System.Threading.ThreadHelper:ThreadStart ()

detail, I'm using mirror with the simpletransport socket that comes by default, using tank's example

2 things to make sure you are doing:

  • call ProcessMessageQueue to process received message, best done on main thread before your main game loop
  • send message to keep connection alive so it doesn't timeout. Mirror does this by sending ping/pong message every 2 seconds. You can also increase the timeout so you can send message less often.

I am doing the same thing. I am creating the server in a c# console so this has helped me as welll thanks!