Open Jakobi-mirsk opened 2 years ago
These reasons will cause the client to no longer try to reconnect:
DisconnecdAsync()
Options.ReconnectionAttempts
Connecting
, an uncaught exception is thrownThe default value of Options.Reconnection
is true, in other cases, the client will keep trying to reconnect until the connection is successful or the above situations occur.
btw, are you using the latest version of the client library?
hi I am using version 3.0.3 These are my options: options.Reconnection = true; options.ReconnectionAttempts = int.MaxValue; options.ReconnectionDelay = 1000; options.ReconnectionDelayMax = 5000; options.RandomizationFactor = 0.5;
If the server is disconnecting, would the OnDisconnected event fire? If and uncaught exception is thrown during connecting, would the OnError event fire?
If the server is disconnecting, would the OnDisconnected event fire?
yeah
If and uncaught exception is thrown during connecting, would the OnError event fire?
no, it is fired upon a connection error. https://github.com/doghappy/socket.io-client-csharp/issues/231
H, thank for the quick answers If the client is never sending but only receiving data from the server. how will it know, when the connection is down for some reason?
socket.OnDisconnected+= Socket_OnDisconnected;
...
private void Socket_OnDisconnected(object sender, string e)
{
Console.WriteLine("reason: " + e);
}
Okay. I cannot rule out that there is something wrong with the server but we have to client that connect to the server on the same event and receives the same data. Only one of the clients did not receive any data for a long time. That is the reason I believe that there is something wrong with the connection.
is there any way to enable some debug output in the library?
You need to remove the reference from NuGet first, then clone this repo and add SocketIOClient.csproj to your project.
You can use Debug or other
Of course, you can also use breakpoint debugging
i have similiar issue after i got connected i turned off internet (on the client) and only after ~50 seconds i got disconnected even after doing this:
TimeSpan interval = new TimeSpan(0, 0, 10); //to get 10 seconds
SocketIOOptions options = new SocketIOOptions();
options.Reconnection = false;
options.ConnectionTimeout = interval;
and i didnt got any message on client.OnError and i tried it without putting value in ConnectionTimeout i tried that too:
socket.OnDisconnected+= Socket_OnDisconnected;
...
private void Socket_OnDisconnected(object sender, string e)
{
Console.WriteLine("reason: " + e);
}
i got this: reason: transport close
is there any way to get disconnected message faster (without adding client.DisconnectAsync();
)?
We are seeing that sometimes we do not get notified of disconnects. We are using the default values for reconnection. The server side (made in java-script) is getting notified when the client is not connected anymore. Is there anything we should keep in mind regarding the reconnection mechanism? It is not all the time we see this problem. Sometimes it works and sometimes it doesn't.