Call `onClosed` or provide an `onStopped` method to be called when the connection is stopped in certain cases
Haidar0096 opened this issue · comments
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I was running a Flutter app that uses on its android side the signalr java client.
In the android side (the java client), I listen to the onClosed callback from the java client to schedule automatice reconnects in my app.
I was doing a heavy download on my wifi network which was taking the bandwidth from all other apps including my app mentioned above, so the activatePingTimer method appears to have timedout and called the private stop method.
The problem is that this private stop
method, does not call the onClosed
callback registered by my app, so my app never knew the connection was closed so that it can reschedule an auto-reconnect.
I know that the onClosed
callback is documented as
Registers a callback to run when the connection is closed.
But does not this case indicate that connection is closed?
If this is a bug, then the private stop
method should call the onClosed
callbacks.
Else if this is how its intended to work, then can you provide a way to listen to when the connection stops?
(Whats the difference anyway between "stop" and "close", other than that "close" disposes the resources associated with the object?)
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
No response
Anything else?
Here is a part of the logs
I/HubConnection( 2748): HubConnection started.
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
E/HubConnection( 2748): HubConnection disconnected with an error: Server timeout elapsed without receiving a message from the server..
I/OkHttpWebSocketWrapper( 2748): WebSocket closing with status code '1000' and reason ''.
E/HubConnection( 2748): HubConnection disconnected with an error Server timeout elapsed without receiving a message from the server..
I/HubConnection( 2748): HubConnection stopped.
I/WebSocketTransport( 2748): WebSocket connection stopped.
(I removed my app logs from the logs above)