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

Added withServerTimeout and withKeepAliveInterval to HubConnectionBuilder for java client #46172

Merged
merged 7 commits into from
Jan 23, 2023

Conversation

surayya-MS
Copy link
Member

@surayya-MS surayya-MS commented Jan 19, 2023

Added withServerTimeout and withKeepAliveInterval to HubConnectionBuilder for java client

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Partially fixes #44742

@ghost ghost added the area-signalr Includes: SignalR clients and servers label Jan 19, 2023
@@ -23,6 +23,8 @@ public class HttpHubConnectionBuilder {
private Map<String, String> headers;
private TransportEnum transportEnum;
private Action1<OkHttpClient.Builder> configureBuilder;
private Long serverTimeout;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use the object Long instead of the primitive long? It also adds unnecessary Object.nonNull code to HubConnection and we're storing it as long anyways.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for that is the following.
If I used primitive long and withServerTimeout wasn't called in HubConnectionBuilder then default value 0 would be passed to HubConnection constructor and there would be a need to check that serverTimeout is not 0. But what if there would be a case when you want to set serverTimeout to 0. That is why I decided to use Long so that default value would be null and I would check for null in the HubConnection constructor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give the values a default so they won't be 0 if not set.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

surayya-MS and others added 2 commits January 23, 2023 19:12
…oft/signalr/HttpHubConnectionBuilder.java

Co-authored-by: Brennan <brecon@microsoft.com>
…oft/signalr/HttpHubConnectionBuilder.java

Co-authored-by: Brennan <brecon@microsoft.com>
@surayya-MS surayya-MS merged commit 0e51178 into dotnet:main Jan 23, 2023
@ghost ghost added this to the 8.0-preview1 milestone Jan 23, 2023
atossell91 pushed a commit to atossell91/aspnetcore that referenced this pull request Jan 23, 2023
…lder for java client (dotnet#46172)

* Added withServerTimeout and withKeepAliveInterval to HubConnectionBuilder for java client
@surayya-MS surayya-MS deleted the hubConnectionJavaClient branch February 23, 2023 18:35
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

Successfully merging this pull request may close these issues.

API proposal: enable configuring connection timeouts in HubConnectionBuilder
2 participants