Update Autobahn server app with native and managed paths.
This commit is contained in:
parent
98e9285fa8
commit
76d3043bbe
|
|
@ -4,9 +4,13 @@
|
|||
"dependencies": {
|
||||
"Microsoft.AspNet.Server.IIS": "1.0.0-beta1-*",
|
||||
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta1-*",
|
||||
"Microsoft.AspNet.WebSockets.Server": "1.0.0-beta1-*"
|
||||
"Microsoft.AspNet.WebSockets.Server": "1.0.0-beta1-*",
|
||||
"Kestrel": "1.0.0-beta1-*"
|
||||
},
|
||||
"commands": {
|
||||
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:12345",
|
||||
"kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:12344"
|
||||
},
|
||||
"commands": { "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:12345" },
|
||||
"frameworks" : {
|
||||
"aspnet50" : { },
|
||||
"aspnetcore50" : { }
|
||||
|
|
|
|||
|
|
@ -15,22 +15,40 @@ namespace AutobahnTestServer
|
|||
{
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
// Comment this out to test native server implementations
|
||||
app.UseWebSockets(new WebSocketOptions()
|
||||
app.Map("/Managed", managedWebSocketsApp =>
|
||||
{
|
||||
ReplaceFeature = true,
|
||||
// Comment this out to test native server implementations
|
||||
managedWebSocketsApp.UseWebSockets(new WebSocketOptions()
|
||||
{
|
||||
ReplaceFeature = true,
|
||||
});
|
||||
|
||||
managedWebSocketsApp.Use(async (context, next) =>
|
||||
{
|
||||
if (context.IsWebSocketRequest)
|
||||
{
|
||||
Console.WriteLine("Echo: " + context.Request.Path);
|
||||
var webSocket = await context.AcceptWebSocketAsync();
|
||||
await Echo(webSocket);
|
||||
return;
|
||||
}
|
||||
await next();
|
||||
});
|
||||
});
|
||||
|
||||
app.Use(async (context, next) =>
|
||||
app.Map("/Native", nativeWebSocketsApp =>
|
||||
{
|
||||
if (context.IsWebSocketRequest)
|
||||
nativeWebSocketsApp.Use(async (context, next) =>
|
||||
{
|
||||
Console.WriteLine("Echo: " + context.Request.Path);
|
||||
var webSocket = await context.AcceptWebSocketAsync();
|
||||
await Echo(webSocket);
|
||||
return;
|
||||
}
|
||||
await next();
|
||||
if (context.IsWebSocketRequest)
|
||||
{
|
||||
Console.WriteLine("Echo: " + context.Request.Path);
|
||||
var webSocket = await context.AcceptWebSocketAsync();
|
||||
await Echo(webSocket);
|
||||
return;
|
||||
}
|
||||
await next();
|
||||
});
|
||||
});
|
||||
|
||||
app.Run(context =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue