Exemple #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseCors("AllowAll");

            var info = new JsonRpcInfo
            {
                Description = "Api for JsonRpc chat",
                Title       = "Chat API",
                Version     = "v1",
                Contact     = new JsonRpcContact
                {
                    Name  = "The Dude",
                    Email = "*****@*****.**",
                    Url   = "http://www.thedude.com"
                }
            };

            app.UseJsonRpcApi(info);

            app.UseWebSockets();
            app.AddJsonRpcService <ChatJsonRpcWebSocketService>();
            var doc        = new JsonRpcDoc(info);
            var serviceDoc = DocGenerator.GenerateJsonRpcServiceDoc(typeof(ChatJsonRpcWebSocketService), doc);

            app.Run(async(context) => { await context.Response.WriteAsync("Hello World!"); });
        }