Пример #1
0
 public DiskController(IQuery query, ISelectorStorage selectorStorage,
                       IWebSocketConnectionsService connectionsService, INotificationQuery notificationQuery)
 {
     _query              = query;
     _iStorage           = selectorStorage.Get(SelectorStorage.StorageServices.SubPath);
     _connectionsService = connectionsService;
     _notificationQuery  = notificationQuery;
 }
Пример #2
0
 public ThumbnailGenerationController(ISelectorStorage selectorStorage,
                                      IQuery query, IWebLogger logger, IWebSocketConnectionsService connectionsService)
 {
     _selectorStorage    = selectorStorage;
     _query              = query;
     _logger             = logger;
     _connectionsService = connectionsService;
 }
Пример #3
0
 internal SyncWatcherConnector(AppSettings appSettings, ISynchronize synchronize,
                               IWebSocketConnectionsService connectionsService, IQuery query, IWebLogger logger, TelemetryClient?telemetryClient)
 {
     _appSettings        = appSettings;
     _synchronize        = synchronize;
     _connectionsService = connectionsService;
     _query           = query;
     _logger          = logger;
     _telemetryClient = telemetryClient;
 }
Пример #4
0
 public ManualBackgroundSyncService(ISynchronize synchronize, IQuery query,
                                    IWebSocketConnectionsService connectionsService,
                                    IMemoryCache cache, IWebLogger logger, IUpdateBackgroundTaskQueue bgTaskQueue,
                                    IServiceScopeFactory scopeFactory)
 {
     _synchronize        = synchronize;
     _connectionsService = connectionsService;
     _query        = query;
     _cache        = cache;
     _logger       = logger;
     _bgTaskQueue  = bgTaskQueue;
     _scopeFactory = scopeFactory;
 }
Пример #5
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            ITextWebSocketSubprotocol textWebSocketSubprotocol = new PlainTextWebSocketSubprotocol();

            app.UseStaticFiles()
            .UseWebSockets()
            .MapWebSocketConnections("/socket", new WebSocketConnectionsOptions
            {
                SupportedSubProtocols = new List <ITextWebSocketSubprotocol>
                {
                    new JsonWebSocketSubprotocol(),
                    textWebSocketSubprotocol
                },
                DefaultSubProtocol = textWebSocketSubprotocol
            })
            .Run(async(context) =>
            {
                await context.Response.WriteAsync("-- Demo.AspNetCore.WebSocket --");
            });

            // Only for demo purposes, don't do this kind of thing to your production
            IWebSocketConnectionsService webSocketConnectionsService = serviceProvider.GetService <IWebSocketConnectionsService>();

            System.Threading.Thread webSocketHeartbeatThread = new System.Threading.Thread(new System.Threading.ThreadStart(() =>
            {
                while (true)
                {
                    webSocketConnectionsService.SendToAllAsync("Demo.AspNetCore.WebSockets Heartbeat", System.Threading.CancellationToken.None).Wait();
                    System.Threading.Thread.Sleep(5000);
                }
            }));
            webSocketHeartbeatThread.Start();
        }
 public WebSocketConnectionsMiddleware(RequestDelegate next, WebSocketConnectionsOptions options, IWebSocketConnectionsService connectionsService, IWebSocketCompressionService compressionService)
 {
     _options            = options ?? throw new ArgumentNullException(nameof(options));
     _connectionsService = connectionsService ?? throw new ArgumentNullException(nameof(connectionsService));
     _compressionService = compressionService ?? throw new ArgumentNullException(nameof(compressionService));
 }
Пример #7
0
 public RealtimeConnectionsService(IWebSocketConnectionsService webSocketConnectionsService, INotificationQuery notificationQuery, IWebLogger logger)
 {
     _webSocketConnectionsService = webSocketConnectionsService;
     _notificationQuery           = notificationQuery;
     _logger = logger;
 }
Пример #8
0
 public ThreadStatsChangefeedBackgroundService(IThreadStatsChangefeedDbService threadStatsChangefeedDbService, IServerSentEventsService serverSentEventsService, IWebSocketConnectionsService webSocketConnectionsService)
 {
     _threadStatsChangefeedDbService = threadStatsChangefeedDbService;
     _serverSentEventsService        = serverSentEventsService;
     _webSocketConnectionsService    = webSocketConnectionsService;
 }
 public HeartbeatService(IWebSocketConnectionsService webSocketConnectionsService)
 {
     _webSocketConnectionsService = webSocketConnectionsService;
 }
Пример #10
0
 public WebSocketConnectionsMiddleware(RequestDelegate next, IWebSocketConnectionsService connectionsService)
 {
     _next = next;
     _connectionsService = connectionsService ?? throw new ArgumentNullException(nameof(connectionsService));
 }
Пример #11
0
 public HeartbeatService(IWebSocketConnectionsService connectionsService)
 {
     _connectionsService = connectionsService;
 }