Microsoft Announces SignalR For ASP.NET Core 2.0

Microsoft announced an alpha release of SignalR for ASP.NET Core 2.0 on September 14, 2017. This is the first official release of a new SignalR that is compatible with ASP.NET Core and consists of a server component, a .NET client targeting .NET Standard 2.0 and a JavaScript/TypeScript client.

"ASP.NET SignalR is a new library for ASP.NET developers that make developing real-time web functionality easy. SignalR allows bi-directional communication between server and client. Servers can now push content to connected clients instantly as it becomes available. SignalR supports Web Sockets, and falls back to other compatible techniques for older browsers. SignalR includes APIs for connection management (for instance, connect and disconnect events), grouping connections, and authorization".

SignalR for ASP.NET Core is a rewrite of the original SignalR. The new SignalR is simpler, more reliable, and easier to use with the user-facing APIs similar to previous versions.

New Features of SignalR for ASP.NET Core 2.0 is listed as below

  • JavaScript/TypeScript Client: SignalR for ASP.NET Core has a new JavaScript clients written in TypeScript and independent of jQuery. The client can also be used from Node.js with a few additional dependencies.The JavaScript client runs on the latest Chrome, FireFox, Edge, Safari and Opera browsers as well as Internet Explorer version 11, 10, 9. (Not all transports are compatible with every browser). Internet Explorer 8 and below is not supported.
  • Support for Binary Protocols: SignalR for ASP.NET Core offers two built-in hub protocols - a text protocol based on JSON and a binary protocol based on MessagePack. However, messages using the MessagePack protocol are typically smaller than messages using the JSON protocol.
  • Support for Custom Protocols: The SignalR hub protocol is documented on GitHub and now has the ability to plug in custom implementations.
  • Streaming: It is now possible to stream data from the server to the client. It can now send results to the client before the invocation completes unlike a regular Hub method invocation.
  • Using SignalR with bare websockets: The process of connecting to SignalR has been simplified so that it can connect to the server without any client with a single request.when using websockets.
  • Simplified Scale-Out Model: Microsoft is providing a Redis based scale-out component in this Alpha release.

SignalR for ASP.NET Core is not compatible with previous versions of SignalR. This means that it is not possible to use the old server with the new clients or the old clients with the new server. Below are the features which either don’t exist in the new version of SignalR. Or have been modified

Features removed

  • Simplified Connection Model: This feature is no longer supported with the new SignalR.
  • Automatic reconnects: if the client is disconnected the user must explicitly start a new connection if they want to reconnect. It will save the cost of storing messages sent to clients, which were prohibitive and lessen the memory foot print.
  • The new version of SignalR does not support having more than one Hub per connection.
  • The ability to pass arbitrary state between clients and the Hub (a.k.a. HubState) has been removed as well as the support for Progress messages. Counterpart of hub proxies doesn’t exist in the new version at the moment.

Sticky Sessions are however now required because once the client connects to the server it needs to interact with this server for the duration of the connection.

Microsoft will release a migrating from existing SignalR guide in the coming weeks as per the website. It encourages users to try this alpha release keeping in mind the Known Issues it has listed on the site.

Up Next