diff --git a/src/HealthChecks.SignalR/DependencyInjection/SignalRHealthCheckBuilderExtensions.cs b/src/HealthChecks.SignalR/DependencyInjection/SignalRHealthCheckBuilderExtensions.cs index e3550c3220..a21baa84df 100644 --- a/src/HealthChecks.SignalR/DependencyInjection/SignalRHealthCheckBuilderExtensions.cs +++ b/src/HealthChecks.SignalR/DependencyInjection/SignalRHealthCheckBuilderExtensions.cs @@ -75,4 +75,34 @@ public static IHealthChecksBuilder AddSignalRHub( tags, timeout)); } + + /// + /// Add a health check for SignalR. + /// + /// The . + /// The SignalR hub connection builder factory to be used. + /// The health check name. Optional. If null the type name 'signalr' will be used for the name. + /// + /// The that should be reported when the health check fails. Optional. If null then + /// the default status of will be reported. + /// + /// A list of tags that can be used to filter sets of health checks. Optional. + /// An optional representing the timeout of the check. + /// The specified . + public static IHealthChecksBuilder AddSignalRHub( + this IHealthChecksBuilder builder, + Func> hubConnectionBuilderFactory, + string? name = default, + HealthStatus? failureStatus = default, + IEnumerable? tags = default, + TimeSpan? timeout = default) + { + return builder.Add( + new HealthCheckRegistration( + name ?? NAME, + sp => new SignalRHealthCheck(hubConnectionBuilderFactory(sp)), + failureStatus, + tags, + timeout)); + } }