socket.io-client-csharp
socket.io-client-csharp copied to clipboard
ReconnectionDelay Bug
The number you set for ReconnectionDelay, RandomizationFactor, ReconnectionDelayMax is ignored and always makes a reconnection request after 4 seconds.
[Code]
var socketIO = new SocketIO(url, new SocketIOOptions
{
Auth = auth,
Reconnection = true,
ReconnectionDelay = 1000,
RandomizationFactor = 0.5,
ReconnectionDelayMax = 60 * 1000,
});
socketIO.OnReconnectAttempt += (sender, i) =>
{
Logger.Debug("Reconnecting...");
};
[Log] 00:00 OnDisconnect 00:08 Reconnecting... 00:12 Reconnecting... 00:16 Reconnecting... 00:20 Reconnecting... ...
I am also facing same issue
Could you please provide quick fix for this and Emit Async issue
I bumped into this too. And started poking around to see if I can fix it. So I started taking a look at the code and was having trouble understanding what I was seeing in my app. So I planned to add some tracing to see what was happening. But when I updated my app to use the local copy instead of the nuget package I found the problem was gone 😄...
So I think it may have already been fixed. So I checked to see if there are any juicy commits after the 3.0.8 version. https://github.com/doghappy/socket.io-client-csharp/compare/v3.0.8...master
And the top one looks very juicy indeed https://github.com/doghappy/socket.io-client-csharp/commit/99b00e67df8c9ba25d8647b795f9391cae649a41
improve connection and reconnection
I think change that fixes this is here in https://github.com/doghappy/socket.io-client-csharp/commit/99b00e67df8c9ba25d8647b795f9391cae649a41#diff-b6f0acdb1d5a56a6cdad3e4c9c1f03807a05eb93bbeff8362ae738386a893081R257
With the addition of this line top of ConnectInBackground
_reconnectionDelay = Options.ReconnectionDelay;
So I think there are few options to move forward
- Pull master and build it reference that in place of the nuget package
- Wait for a new package 😉
- You could also inject your own delay in
OnReconnectError
I think my plan is to do #3
until #2
happens.