public static ISignalRBuilder AddRedis(this ISignalRBuilder builder, string redisConnectionString) { return(AddRedis(builder, o => { o.Options = ConfigurationOptions.Parse(redisConnectionString); })); }
public static ISignalRBuilder AddTankaGraphQL(this ISignalRBuilder builder) { builder.AddJsonProtocol(options => { if (!options.PayloadSerializerOptions.Converters.Any(converter => converter is ObjectDictionaryConverter)) { options.PayloadSerializerOptions.Converters .Add(new ObjectDictionaryConverter()); } }); return(builder); }
public static ISignalRBuilder AddOrleans(this ISignalRBuilder builder, IClusterClientProvider clientProvider = null) { if (clientProvider != null) { builder.Services.AddSingleton(clientProvider); } else { builder.Services.TryAddSingleton <IClusterClientProvider, DefaultClusterClientProvider>(); } builder.Services.AddSingleton(typeof(HubLifetimeManager <>), typeof(OrleansHubLifetimeManager <>)); return(builder); }
/// <summary> /// Configures SignalR to use the OrgnalR backplane. Requires that an <see cref="IClusterClient"/> is registered. /// If at runtime, your application cannot resolve an IClusterClient, ensure you register one. /// Alternatively, before calling this method, register an <see cref="IGrainFactoryProvider"/>. /// </summary> /// <param name="builder">The SignalR build to configure</param> /// <returns>The same same builder, configured to use OrgnalR</returns> public static ISignalRBuilder UseOrgnalR(this ISignalRBuilder builder) { try { try { // Most people will register their client as an IClusterClient. builder.Services.AddSingleton <IGrainFactory>(s => s.GetService <IClusterClient>()); } catch { /* Do nothing, already added */ } // Will pull the grain factory from the registered services builder.Services.AddSingleton <IGrainFactoryProvider, GrainFactoryProvider>(); } catch { /* Do nothing, already added */ } builder.Services.AddSingleton(typeof(IGroupActorProvider <>), typeof(GroupActorProviderFactory <>)); builder.Services.AddSingleton(typeof(IUserActorProvider <>), typeof(GroupActorProviderFactory <>)); builder.Services.AddSingleton(typeof(IMessageObservable <>), typeof(MessageObservableFactory <>)); builder.Services.AddSingleton(typeof(IMessageObserver <>), typeof(MessageObserverFactory <>)); builder.Services.AddSingleton(typeof(HubLifetimeManager <>), typeof(OrgnalRHubLifetimeManagerFactory <>)); return(builder); }
public static ISignalRBuilder AddHubOptions <THub>(this ISignalRBuilder signalrBuilder, Action <HubOptions <THub> > options) where THub : Hub { signalrBuilder.Services.AddSingleton <IConfigureOptions <HubOptions <THub> >, HubOptionsSetup <THub> >(); signalrBuilder.Services.Configure(options); return(signalrBuilder); }
/// <summary> /// Enables the MsgPack protocol for SignalR and allows options for the MsgPack protocol to be configured. /// </summary> /// <remarks> /// Any options configured here will be applied, even if the MsgPack protocol has already been registered with the server. /// </remarks> /// <param name="builder">The <see cref="ISignalRBuilder"/> representing the SignalR server to add MsgPack protocol support to.</param> /// <param name="configure">A delegate that can be used to configure the <see cref="MessagePackHubProtocolOptions"/></param> /// <returns>The value of <paramref name="builder"/></returns> public static ISignalRBuilder AddMessagePackProtocol(this ISignalRBuilder builder, Action <MessagePackHubProtocolOptions> configure) { builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton <IHubProtocol, MessagePackHubProtocol>()); builder.Services.Configure(configure); return(builder); }
/// <summary> /// Enables the MsgPack protocol for SignalR. /// </summary> /// <remarks> /// This has no effect if the MsgPack protocol has already been enabled. /// </remarks> /// <param name="builder">The <see cref="ISignalRBuilder"/> representing the SignalR server to add MsgPack protocol support to.</param> /// <returns>The value of <paramref name="builder"/></returns> public static ISignalRBuilder AddMessagePackProtocol(this ISignalRBuilder builder) => AddMessagePackProtocol(builder, _ => { });
public static ISignalRBuilder AddSignalROptions(this ISignalRBuilder builder, Action <SignalROptions> configure) { builder.Services.Configure(configure); return(builder); }
public static ISignalRBuilder AddRedis(this ISignalRBuilder builder, Action <RedisOptions> configure) { builder.Services.Configure(configure); builder.Services.AddSingleton(typeof(HubLifetimeManager <>), typeof(RedisHubLifetimeManager <>)); return(builder); }
public static ISignalRBuilder AddRedis(this ISignalRBuilder builder) { return(AddRedis(builder, o => { })); }
public static ISignalRBuilder AddOrleans(this ISignalRBuilder builder) { builder.Services.AddSingleton(typeof(HubLifetimeManager <>), typeof(OrleansHubLifetimeManager <>)); return(builder); }
/// <summary> /// Enables the JSON protocol for SignalR. /// </summary> /// <remarks> /// This has no effect if the JSON protocol has already been enabled. /// </remarks> /// <param name="builder">The <see cref="ISignalRBuilder"/> representing the SignalR server to add JSON protocol support to.</param> /// <returns>The value of <paramref name="builder"/></returns> public static ISignalRBuilder AddJsonProtocol(this ISignalRBuilder builder) => AddJsonProtocol(builder, _ => { });