Start() 공개 정적인 메소드

public static Start ( ) : void
리턴 void
예제 #1
0
        public void Configuration(IAppBuilder app)
        {
            app.MapSignalR <SendingConnection>("/sending-connection");
            app.MapSignalR <TestConnection>("/test-connection");
            app.MapSignalR <RawConnection>("/raw-connection");
            app.MapSignalR <StreamingConnection>("/streaming-connection");

            app.Use(typeof(ClaimsMiddleware));

            ConfigureSignalR(GlobalHost.DependencyResolver, GlobalHost.HubPipeline);

            var config = new HubConfiguration()
            {
                EnableDetailedErrors = true
            };

            app.MapSignalR(config);

            app.Map("/cors", map =>
            {
                map.UseCors(CorsOptions.AllowAll);
                map.MapSignalR <RawConnection>("/raw-connection");
                map.MapSignalR();
            });

            app.Map("/basicauth", map =>
            {
                map.UseBasicAuthentication(new BasicAuthenticationProvider());
                map.MapSignalR <AuthenticatedEchoConnection>("/echo");
                map.MapSignalR();
            });

            BackgroundThread.Start();
        }
예제 #2
0
        public void Configuration(IAppBuilder app)
        {
            app.MapSignalR <SendingConnection>("/sending-connection");
            app.MapSignalR <TestConnection>("/test-connection");
            app.MapSignalR <RawConnection>("/raw-connection");
            app.MapSignalR <StreamingConnection>("/streaming-connection");

            app.Use(typeof(ClaimsMiddleware));

            ConfigureSignalR(GlobalHost.DependencyResolver, GlobalHost.HubPipeline);

            app.Map("/cors", map =>
            {
                map.UseCors(CorsOptions.AllowAll);
                map.MapSignalR <RawConnection>("/raw-connection");
                map.MapSignalR();
            });

            app.Map("/cookieauth", map =>
            {
                var options = new CookieAuthenticationOptions()
                {
                    AuthenticationType = CookieAuthenticationDefaults.AuthenticationType,
                    LoginPath          = CookieAuthenticationDefaults.LoginPath,
                    LogoutPath         = CookieAuthenticationDefaults.LogoutPath,
                };

                map.UseCookieAuthentication(options);

                map.Use(async(context, next) =>
                {
                    if (context.Request.Path.Value.Contains(options.LoginPath.Value))
                    {
                        if (context.Request.Method == "POST")
                        {
                            var form     = await context.Request.ReadFormAsync();
                            var userName = form["UserName"];
                            var password = form["Password"];

                            var identity = new ClaimsIdentity(options.AuthenticationType);
                            identity.AddClaim(new Claim(ClaimTypes.Name, userName));
                            context.Authentication.SignIn(identity);
                        }
                    }
                    else
                    {
                        await next();
                    }
                });

                map.MapSignalR <AuthenticatedEchoConnection>("/echo");
                map.MapSignalR();
            });

            var config = new HubConfiguration()
            {
                EnableDetailedErrors = true
            };

            app.MapSignalR(config);

            BackgroundThread.Start();
        }
예제 #3
0
 protected void Application_Start(object sender, EventArgs e)
 {
     SignalRConfig.ConfigureSignalR(GlobalHost.DependencyResolver, GlobalHost.HubPipeline);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BackgroundThread.Start();
 }