コード例 #1
0
ファイル: TraCIClient.cs プロジェクト: traffic3d/traffic3d
 internal void OnVehicleSubscription(SubscriptionEventArgs eventArgs)
 {
     VehicleSubscription?.Invoke(this, eventArgs);
 }
コード例 #2
0
 public Task Add(VehicleSubscription value)
 => Task.FromResult(_storage[value.Id] = value);
コード例 #3
0
 public static Task SubscribeEvents(this IServiceBusListenerFactory listener, IStatusCache statusCache, VehicleSubscription vehicleSubscription)
 => listener.Create()
 .SubscribeVehicleInfo(t => statusCache.Update(t.Id, t))
 .SubscribeVehicleInfo(vehicleSubscription.Send);
コード例 #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime lifetime, IServiceBusListenerFactory listenerFactory, IStatusCache statusCache, VehicleSubscription vehicleSubscription)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseAuthentication();

            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), @"client-build")),
                RequestPath  = new PathString(@"/client-build")
            });

            app.UseSignalR(routes => routes.MapHub <VehicleHub>("/vehicleHub"));
            app.UseMvc();
            lifetime.ApplicationStarted.Register(() => listenerFactory.SubscribeEvents(statusCache, vehicleSubscription));
        }