Announcing SignalR for ASP.NET Core Alpha 2
A few weeks ago we released the alpha1 version of SignalR for ASP.NET Core 2.0. Today we are pleased to announce a release of the alpha2 version of SignalR for ASP.NET Core 2.0. This release contains a number of changes (including API changes) and improvements.
- The JSON hub protocol now uses camel casing by default when serializing and deserializing objects on the server and by the C# client
- IObservable subscriptions for streaming methods are now automatically unsubscribed when the connection is closed
- It is now possible to invoke client methods in a type safe manner when using HubContext (a community contribution from FTWinston– Thanks!)
- A new HubConnectionContext.Abort() method allows terminating connections from the server side
- Users can now control how their objects are serialized when using MessagePack hub protocol
- Length prefixes used in binary protocols are now encoded using Varints which reduces the size of the message by up to 7 bytes
- Event names were changed and now use lower case:
- onDataReceived on IConnection was renamed to onreceive
- onClosed on HubConnection and IConnection was renamed to onclose
- It is now possible to register multiple handlers for the HubConnection onclose event by passing the handler as a parameter. The code used to subscribe to the closed event when using the alpha1 version of the client:
needs to be changed to:
- The HubConnection on() method now allows registering multiple callbacks for a client method invocation
- A new off() method was added to HubConnection to enable removing callbacks registered with the on method
The HubConnection.Stream() method was changed to be async and renamed to StreamAsync()
New overloads of WithJsonHubProtocol() and WithMessagePackProtocol() on HubConnectionBuilder that take protocol-specific settings were added
The params keyword was removed from the IClientProxy.InvokeAsync() method and replaced by a set of extension methods
A word of thanks to everyone who has tried the new SignalR and provided feedback. Please keep it up! You can provide feedback or let us know about bugs/issues here.
For examples on using this, and future, versions you can look at the SignalR Samples repository on GitHub.