Open marcomarchesi opened 8 years ago
I'm having the same issue, but only when the server is turned off. It would be nice to be able to manually set the timeout for closed sockets. Am I missing something?
ws.WaitTime = TimeSpan.FromSeconds(1);
doesn't seem to do the trick.
try ws.ConnectAsync();
Oh wow, not sure how I missed that. Either way I added my own implementation in #293 because I wanted more control on how long it would wait for a connection.
I already use .ConnectAsync() in unity, still can't change the default timeout...
public IEnumerator ConnectRoutine(string endpoint) {
ws = new WebSocket(endpoint);
#if DEBUG
ws.Log.Level = LogLevel.Info;
ws.Log.File = "ws.log";
#endif
ws.OnOpen += Ws_OnOpen; // sets isConnected
ws.OnMessage += Ws_OnMessage;
ws.OnError += Ws_OnError;
ws.ConnectAsync();
while (!isConnected)
yield return null;
}
I really like @jespertheend 's PR https://github.com/sta/websocket-sharp/pull/293 thou...
get the same problem
It happens sometimes
I came to this issue because a similar phenomenon was reproduced.
I've just started working with
websocket-sharp
and Unity, I created client and server applications to test it in the same machine. Everything works fine usinglocalhost
as local address. Then, I tried to run the server and the client from different machines. Client calls the server withws://192.168.1.x:8080/something
but once I try to play the client from the Unity Editor or from the built app, it freezes for 10-20 seconds but it cannot connect. Currently I'm running the server on a Windows machine and the client on a MacbookPro. If I try to use explicitly an IP address in the same machine for both client and server apps, but I cannot connect. Any ideas?