-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Check HubConnection state before running invoke logic #4400
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
Conversation
src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java
Outdated
Show resolved
Hide resolved
@mikaelm12 can you also add the shiproom template? (You can find a copy from #4403) |
Added the template |
Approved for 2.2.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Buid checks seem to be failing.
The failure was for an IIS Functional test. An unrelated test failure.
|
Not sure how we ship our Java binaries. If necessary, please update the 2.2.2 section of eng/PatchConfig.props: https://github.com/aspnet/Extensions/blob/d8407116d183debaadb801c0cbc41d65927999d6/eng/PatchConfig.props#L7-L10 |
9bdcedc
to
e427c98
Compare
@@ -27,6 +27,7 @@ Later on, this will be checked using this condition: | |||
</PropertyGroup> | |||
<PropertyGroup Condition=" '$(VersionPrefix)' == '2.2.2' "> | |||
<PackagesInPatch> | |||
java:signalr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@natemcmaster This look okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Double check artifacts/ for the .jar file to make sure it worked.
e427c98
to
9c49061
Compare
9c49061
to
2666c6e
Compare
Before calling methods that require the HubConnection to be connected we run a simple connection state check like
https://github.com/aspnet/AspNetCore/blob/e310ccac7b30e901f657f81c86c4048fecfedf7b/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java#L464-L466
Addresses #4393
Description
Before being able to send invocations from a SignalR hub, it's important that we ensure that the current HubConnection is active and in the connected state. If the HubConnection isn't connected we should fail immediately without attmepting to send any invocations. Otherwise we could run into a case where users can write the connected
Customer Impact
With this change, when a customer tries to invoke a hub method when their client is not connected, they will get a helpful error message letting them know that they are in the disconnected state.
Regression
N/A
Risk
Low. This is purely a defensive change. We woul be adding a check to the HubConnection state before continuing to the rest of the invoke logic to ensure that we fail fast with a helpful error message. This also has an associate test.