Skip to content

Added withServerTimeout and withKeepAliveInterval to HubConnectionBuilder for java client#46172

Merged
surayya-MS merged 7 commits intodotnet:mainfrom
surayya-MS:hubConnectionJavaClient
Jan 23, 2023
Merged

Added withServerTimeout and withKeepAliveInterval to HubConnectionBuilder for java client#46172
surayya-MS merged 7 commits intodotnet:mainfrom
surayya-MS:hubConnectionJavaClient

Conversation

@surayya-MS
Copy link
Copy Markdown
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
private Map<String, String> headers;
private TransportEnum transportEnum;
private Action1<OkHttpClient.Builder> configureBuilder;
private Long serverTimeout;
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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