Beispiel #1
0
        public PodeListener(CancellationToken cancellationToken, PodeListenerType type = PodeListenerType.Http)
        {
            CancellationToken = cancellationToken;
            IsDisposed        = false;
            Type = type;

            WebBuilder = new WebHostBuilder();
            WebBuilder.ConfigureServices(s => s.AddRouting());
            WebBuilder.Configure(app => {
                var routeHandler = new RouteHandler(ctx => {
                    var _podeContext = new PodeContext(ctx, this);
                    this.AddContext(_podeContext);
                    return(_podeContext.Start());
                });

                var routeBuilder = new RouteBuilder(app, routeHandler);
                routeBuilder.MapRoute("pode sub-routes", "{*.}");

                var routes = routeBuilder.Build();
                app.UseRouter(routes);
            });

            Sockets  = new List <PodeSocket>();
            Contexts = new BlockingCollection <PodeContext>();
        }
Beispiel #2
0
        public PodeListener(CancellationToken cancellationToken, PodeListenerType type = PodeListenerType.Http)
        {
            CancellationToken = cancellationToken;
            IsDisposed        = false;
            Type = type;

            Sockets       = new List <PodeSocket>();
            WebSockets    = new Dictionary <string, PodeWebSocket>();
            Contexts      = new BlockingCollection <PodeContext>();
            ServerSignals = new BlockingCollection <PodeServerSignal>();
            ClientSignals = new BlockingCollection <PodeClientSignal>();
        }