Exemple #1
0
        private void Configure([NotNull] IHttpServer server)
        {
            var pipeline = new HttpContextPipeline(new SimpleExceptionHandler());

            pipeline.Add(new RequestHeaderFixture());
            pipeline.Add(new RequestBodyHandler());
            pipeline.Add(new ResponseBodyLengthHandler());
            pipeline.Add(new ResponseCompressionHandler());
            pipeline.Add(new JsonRpcValidator(GetExtraValidators()));
            pipeline.Add(Router);

            server.RequestHandler = pipeline;
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            HttpNetTrace.TraceMessagePublished += (s, e) => Console.WriteLine("[" + e.Source + "] [" + e.Level + "] [" + e.Message + "] [" + e.Exception + "]");

            var pipeline = new HttpContextPipeline(new SimpleExceptionHandler());

            pipeline.Add(new RequestBodyHandler());
            pipeline.Add(new TraceHandler());
            pipeline.Add(new WebSocketRequestHandler(ComputeSha1Hash, SessionCreated));
            pipeline.Add(new ResponseBodyLengthHandler());
            pipeline.Add(new ResponseCompressionHandler());
            pipeline.Add(new SimpleHttpRequestHandler());

            var httpServer = new HttpServerFactory().CreateHttpServer();

            httpServer.RequestHandler = pipeline;
            httpServer.StartAsync(HttpServerOptions.Default).GetAwaiter().GetResult();


            Thread.Sleep(Timeout.Infinite);
        }