using Microsoft.AspNet.SignalR; using Microsoft.AspNet.SignalR.Hosting.Memory; var host = new MemoryHost(); var hubConfiguration = new HubConfiguration(); var route = new HubRoute("myhub", GlobalHost.DependencyResolver, hubConfiguration); host.Configuration.Routes.MapHubs(route); var connection = new Connection(host); connection.Start().Wait();
using Microsoft.AspNet.SignalR.Hosting.Memory; var host = new MemoryHost(); host.Configure(app => { app.Use((context, next) => { context.Environment["custom_key"] = "custom_value"; return next(); }); });This code creates a new in-memory hosting environment and adds a custom middleware component that sets an environment variable called "custom_key" to a value of "custom_value". This middleware will be called for every request that is processed by the hosting environment.