ASP.NET Core 1.0 WebSocket Setup? -


i'm struggling find example setup websockets in asp.net core 1.0; seem previous versions of asp.net , rely on properties don't seem exist under context (for me).

main documentation has 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. correct approach in asp.net core 1.0?

after disassembly looks been moved around little; , there new websocketmanager

app.usewebsockets();  app.use(async (context, next) => {     var http = (httpcontext) context;      if (http.websockets.iswebsocketrequest)     {         websocket websocket = await http.websockets.acceptwebsocketasync();     } }); 

also turns out because there compile error, assumed context of type requestdelegate. after fixing usage context.websockets.iswebsocketrequest knows context httpcontext


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -