Skip to content

SignalR HubConnectionContext constructors changing #14845

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

Closed
jkotalik opened this issue Sep 30, 2019 · 0 comments · Fixed by #15044
Closed

SignalR HubConnectionContext constructors changing #14845

jkotalik opened this issue Sep 30, 2019 · 0 comments · Fixed by #15044
Assignees
Labels
breaking-change Indicates a .NET Core breaking change

Comments

@jkotalik
Copy link
Contributor

SignalR HubConnectionContext constructors changing

We are changing SignalR's HubConnectionContext constructors to take in an options type rather than multiple parameters to future proof adding options. This removes two constructors in favor of a single constructor which takes an option type.

Version introduced

3.0

Old behavior

Prior to 3.0 HubConnectionContext had two constructors:

public HubConnectionContext(ConnectionContext connectionContext, TimeSpan keepAliveInterval, ILoggerFactory loggerFactory);
public HubConnectionContext(ConnectionContext connectionContext, TimeSpan keepAliveInterval, ILoggerFactory loggerFactory, TimeSpan clientTimeoutInterval);

New behavior

In 3.0 these 2 constructors have been removed and replaced them with a new one:

public HubConnectionContext(ConnectionContext connectionContext, HubConnectionContextOptions contextOptions, ILoggerFactory loggerFactory)

Reason for change

This new constructor makes use of a new options object, so we can expand the features of HubConnectionContext in the future without making more constructors and breaking changes.

Recommended action

Instead of calling:

HubConnectionContext connectionContext = new HubConnectionContext(
    connectionContext, 
    keepAliveInterval: TimeSpan.FromSeconds(15), 
    loggerFactory, 
    clientTimeoutInterval: TimeSpan.FromSeconds(15));

They would now call:

HubConnectionContextOptions contextOptions = new HubConnectionContextOptions()
{
    KeepAliveInterval = TimeSpan.FromSeconds(15),
    ClientTimeoutInterval = TimeSpan.FromSeconds(15)
};
HubConnectionContext connectionContext = new HubConnectionContext(connectionContext, contextOptions, loggerFactory);

Category

ASP.NET Core

Affected APIs

HubConnectionContext.ctor(ConnectionContext, TimeSpan , ILoggerFactory)

HubConnectionContext.ctor(ConnectionContext, TimeSpan , ILoggerFactory, TimeSpan)


Issue metadata

  • Issue type: breaking-change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a .NET Core breaking change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants