Closed RobertoSchneiders closed 4 years ago
Does anyone have any idea what might be causing this?
I changed this:
if(_allowReconnect)
Connect();
for this:
if (_allowReconnect)
{
Thread.Sleep(250);
ChangeState(ConnectionState.Connecting);
_websocket.Open();
}
The idea was to avoid the Connect()
overhead (reacreating objects) and try to do less retry attempts (with the sleep).
improved slightly, but did not solve the problem. With this code, sometimes it takes a few minutes to crash (current version hangs in seconds).
@RobertoSchneiders - could you please try out the latest version from source (master) and let me know how you get on?
The example application has also been updated and should result in simplified setup code: connections and subscriptions. See https://github.com/pusher-community/pusher-websocket-dotnet/blob/master/ExampleApplication/Program.cs#L48-L70
The example application has also been updated and should result in simplified setup code: connections and subscriptions.
Great!
could you please try out the latest version from source (master) and let me know how you get on?
I made some tests using the master branch @leggetter. Results are pretty much the same to those tests with the code I posted above. Unfortunately, not so good.
Connection state: Disconnected
Connection state: WaitingToReconnect
Connection state: Connecting
Pusher Information: 0 : Connecting to: ws://pusher.my_domain.com.br/app/monde?protocol=5&client=pusher-dotnet-client&version=0.0.1
Connection state: Connecting
Crashed in 1m45s.
Today was released the WebSocket4Net 0.14.0, but the results are the same. :/
If you have any idea of the cause of this problem, I can try to fix it, or at least test it for you.
[off-topic] There are some reason for websocket.AutoSendPingInterval
be 1? (code) The default value is 60s. I'll have a lot of connections, so, every request counts.
Fixed by #95
I created a simple console application that subscribes to a channel. When I disable the connection to simulate a connection failure Pusher Client tries desperately to reconnect and after some seconds he hangs.
Hangs with "conecting" status. That is the log:
ProcessExplorer shows the resource consuming.