/// <summary> /// Create signalR event bus /// </summary> /// <param name="config"></param> public SignalRServiceEndpoint(ISignalRServiceConfig config) { Resource = NameAttribute.GetName(typeof(THub)); if (!string.IsNullOrEmpty(config?.SignalRConnString) && config.SignalRServerLess) { _serviceManager = new ServiceManagerBuilder().WithOptions(option => { option.ConnectionString = config.SignalRConnString; option.ServiceTransportType = ServiceTransportType.Persistent; }).Build(); } }
/// <summary> /// Create signalR event bus /// </summary> /// <param name="config"></param> /// <param name="logger"></param> public SignalRServiceHost(ISignalRServiceConfig config, ILogger logger) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); if (string.IsNullOrEmpty(config?.SignalRConnString)) { throw new ArgumentNullException(nameof(config.SignalRConnString)); } _serviceManager = new ServiceManagerBuilder().WithOptions(option => { option.ConnectionString = config.SignalRConnString; option.ServiceTransportType = ServiceTransportType.Persistent; }).Build(); Resource = !string.IsNullOrEmpty(config.SignalRHubName) ? config.SignalRHubName : "default"; }
/// <summary> /// Create signalR event bus /// </summary> /// <param name="config"></param> /// <param name="logger"></param> public SignalRServiceHost(ISignalRServiceConfig config, ILogger logger) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); if (string.IsNullOrEmpty(config?.SignalRConnString)) { throw new ArgumentNullException(nameof(config.SignalRConnString)); } _serviceManager = new ServiceManagerBuilder().WithOptions(option => { option.ConnectionString = config.SignalRConnString; option.ServiceTransportType = ServiceTransportType.Persistent; }).Build(); Resource = !string.IsNullOrEmpty(config.SignalRHubName) ? config.SignalRHubName : "default"; // TODO : force hub renew mechanism introduced to workaround a // signalR SDK bug. To be removed after the fix is done in the SDK _renewHubTimer = new Timer(RenewHubTimer_ElapesedAsync); _renewHubInterval = TimeSpan.FromMinutes(3); }
/// <summary> /// Create signalR event bus /// </summary> /// <param name="config"></param> /// <param name="logger"></param> public SignalRServiceHost(ISignalRServiceConfig config, ILogger logger) : base(config) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); if (string.IsNullOrEmpty(config?.SignalRConnString)) { throw new ArgumentNullException(nameof(config.SignalRConnString)); } if (!config.SignalRServerLess) { throw new ArgumentException( "SignalR is not configured to be in serverless mode according to " + "the configuration. SignalR service should be configured serverless " + "mode for the service host to work. Otherwise you should use " + "Asp.net core as hosting environment."); } _renewHubTimer = new Timer(RenewHubTimer_ElapesedAsync); _renewHubInterval = TimeSpan.FromMinutes(3); }