I'm struggling to find an example to setup WebSockets in ASP.NET Core 1.0; they all seem to be for the previous versions of ASP.NET and some rely on properties that don't seem to exist under context
(for me).
Main documentation only has a placeholder too. http://docs.asp.net/en/latest/
For example:
app.UseWebSockets();
app.Use(async (context, next) =>
{
if (context.IsWebSocketRequest)
{
WebSocket webSocket = await context.AcceptWebSocketAsync();
await EchoWebSocket(webSocket);
}
else
{
await next();
}
});
Doesn't work because IsWebSocketRequest
doesn't exist now. What is the correct approach in ASP.NET Core 1.0?
app.Map("/WebSockets", wsApp => { wsApp.UseWebSockets(); wsApp.Use(/*...*/);