AspNetCore.Docs/aspnetcore/aspnetcore-1.1.md

2.6 KiB

title author description keywords ms.author manager ms.date ms.topic ms.assetid ms.technology ms.prod uid
What's new in ASP.NET Core 1.1 | Microsoft Docs rick-anderson What's new in ASP.NET Core 1.1 ASP.NET Core, bower riande wpickett 02/14/2017 article 062f8353-d1bc-4e99-a821-c1d1bb162c47 aspnet aspnet-core aspnetcore-1.1

What's new in ASP.NET Core 1.1

ASP.NET Core 1.1 includes the following new features:

Choosing between versions 1.0 and 1.1 of ASP.NET Core

ASP.NET Core 1.1 has more features than 1.0. In general, we recommend you use the latest version.

WebSockets support

A new middleware component provides WebSockets support in ASP.NET Core 1.1. Install the Microsoft.AspNetCore.WebSockets package, and add code to the Configure method of the Startup class:

app.UseWebSockets();

Your project will then have access to a WebSockets property on the HttpContext object. You can write your own middleware for the pipeline to interpret and interact with the requests handed to your application by a websocket. You could add this middleware to your configured pipeline with code like the following:

app.Use(async (context, next) =>
{
  if (context.WebSockets.IsWebSocketRequest)
  {
    var webSocket = await context.WebSockets.AcceptWebSocketAsync();
    await DoSomethingCool(context, webSocket);
  }
  else
  {
    await next();
  }
});

The websocket object has SendAsync and ReceiveAsync methods. For samples, see the WebSockets repository.

Additional Information