public static IServiceCollection AddFusionWebSocketClientCore(
     this IServiceCollection services,
     WebSocketChannelProvider.Options options)
 {
     services.TryAddSingleton(options);
     services.TryAddSingleton <IChannelProvider, WebSocketChannelProvider>();
     return(services.AddFusionClientCore());
 }
Exemplo n.º 2
0
        // Common client-side services

        public static IServiceCollection AddFusionWebSocketClient(
            this IServiceCollection services,
            WebSocketChannelProvider.Options options)
        {
            services.TryAddTransient <FusionResponseDeserializer>();
            services.AddRestEaseCore();
            return(services.AddFusionWebSocketClientCore(options));
        }
Exemplo n.º 3
0
 public static IServiceCollection AddFusionWebSocketClient(
     this IServiceCollection services,
     WebSocketChannelProvider.Options options,
     bool addTransient = false)
 {
     services.TryAddSingleton(options);
     services.TryAddSingleton <IChannelProvider, WebSocketChannelProvider>();
     return(services.AddFusionClientCore().AddFusionRestEaseServices());
 }
Exemplo n.º 4
0
        public FusionRestEaseClientBuilder ConfigureWebSocketChannel(
            WebSocketChannelProvider.Options options)
        {
            var serviceDescriptor = new ServiceDescriptor(
                typeof(WebSocketChannelProvider.Options),
                options);

            Services.Replace(serviceDescriptor);
            return(this);
        }
 public static IServiceCollection AddFusionWebSocketClientCore(
     this IServiceCollection services,
     Action <IServiceProvider, WebSocketChannelProvider.Options>?optionsBuilder = null)
 {
     services.TryAddSingleton(c => {
         var options = new WebSocketChannelProvider.Options();
         optionsBuilder?.Invoke(c, options);
         return(options);
     });
     services.TryAddSingleton <IChannelProvider, WebSocketChannelProvider>();
     return(services.AddFusionClientCore().AddRestEaseCore());
 }
Exemplo n.º 6
0
        public FusionRestEaseClientBuilder ConfigureWebSocketChannel(
            Action <IServiceProvider, WebSocketChannelProvider.Options> optionsBuilder)
        {
            var serviceDescriptor = new ServiceDescriptor(
                typeof(WebSocketChannelProvider.Options),
                c => {
                var options = new WebSocketChannelProvider.Options();
                optionsBuilder.Invoke(c, options);
                return(options);
            },
                ServiceLifetime.Singleton);

            Services.Replace(serviceDescriptor);
            return(this);
        }
        // Common client-side services

        public static IServiceCollection AddFusionWebSocketClient(
            this IServiceCollection services,
            WebSocketChannelProvider.Options options)
        => services
        .AddRestEaseCore()
        .AddFusionWebSocketClientCore(options);