Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call onClosed or provide an onStopped method to be called when the connection is stopped in certain cases #55765

Open
1 task done
Haidar0096 opened this issue May 17, 2024 · 0 comments
Labels
area-signalr Includes: SignalR clients and servers

Comments

@Haidar0096
Copy link
Contributor

Haidar0096 commented May 17, 2024

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)

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-signalr Includes: SignalR clients and servers label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

No branches or pull requests

2 participants
@Haidar0096 and others