{"id":10456,"date":"2017-10-09T15:46:08","date_gmt":"2017-10-09T22:46:08","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/?p=10456"},"modified":"2017-10-09T15:46:08","modified_gmt":"2017-10-09T22:46:08","slug":"announcing-signalr-for-asp-net-core-alpha-2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-signalr-for-asp-net-core-alpha-2\/","title":{"rendered":"Announcing SignalR for ASP.NET Core Alpha 2"},"content":{"rendered":"<p>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.<\/p>\n<h2>Notable Changes<\/h2>\n<ul>\n<li>The JSON hub protocol now uses camel casing by default when serializing and deserializing objects on the server and by the C# client<\/li>\n<li><em>IObservable<\/em> subscriptions for streaming methods are now automatically unsubscribed when the connection is closed<\/li>\n<li>It is now possible to invoke client methods in a type safe manner when using <em>HubContext<\/em> (a community contribution from <a href=\"https:\/\/github.com\/FTWinston\">FTWinston<\/a>&#8211; Thanks!)<\/li>\n<li>A new <em>HubConnectionContext.Abort()<\/em> method allows terminating connections from the server side<\/li>\n<li>Users can now control how their objects are serialized when using <em>MessagePack<\/em> hub protocol<\/li>\n<li>Length prefixes used in binary protocols are now encoded using <a href=\"https:\/\/developers.google.com\/protocol-buffers\/docs\/encoding#varints\">Varints<\/a> which reduces the size of the message by up to 7 bytes<\/li>\n<\/ul>\n<p><a href=\"https:\/\/github.com\/aspnet\/SignalR\/releases\/tag\/1.0.0-alpha2\">Release notes can be found on github.<\/a><\/p>\n<h2>API Changes<\/h2>\n<h3>TypeScript\/JavaScript client:<\/h3>\n<ul>\n<li>Event names were changed and now use lower case: \n<ul>\n<li><em>onDataReceived<\/em> on <em>IConnection<\/em> was renamed to <em>onreceive<\/em><\/li>\n<li><em>onClosed<\/em> on <em>HubConnection<\/em> and <em>IConnection<\/em> was renamed to <em>onclose<\/em><\/li>\n<\/ul>\n<\/li>\n<li>It is now possible to register multiple handlers for the <em>HubConnection<\/em> <em>onclose<\/em> 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:<\/li>\n<\/ul>\n<p>needs to be changed to:<\/p>\n<ul>\n<li>The <em>HubConnection<\/em> <em>on()<\/em> method now allows registering multiple callbacks for a client method invocation<\/li>\n<li>A new <em>off()<\/em> method was added to <em>HubConnection<\/em> to enable removing callbacks registered with the <em>on<\/em> method<\/li>\n<\/ul>\n<h3>C# Client<\/h3>\n<p>The <em>HubConnection.Stream()<\/em> method was changed to be <em>async<\/em> and renamed to <em>StreamAsync()<\/em> New overloads of <em>WithJsonHubProtocol()<\/em> and <em>WithMessagePackProtocol()<\/em> on <em>HubConnectionBuilder<\/em> that take protocol-specific settings were added<\/p>\n<h3>Server<\/h3>\n<p>The <em>params<\/em> keyword was removed from the <em>IClientProxy.InvokeAsync()<\/em> method and replaced by a set of extension methods<\/p>\n<p><strong>A word of thanks to everyone who has tried the new SignalR and provided feedback. Please keep it up!<\/strong> You can provide feedback or let us know about bugs\/issues\u00a0<a href=\"https:\/\/github.com\/aspnet\/SignalR\/issues\/new\">here<\/a>.<\/p>\n<p>For examples on using this, and future, versions you can look at the <a href=\"https:\/\/github.com\/aspnet\/signalr-samples\">SignalR Samples repository<\/a> on GitHub.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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. Notable Changes The JSON hub protocol now uses camel casing [&hellip;]<\/p>\n","protected":false},"author":1235,"featured_media":58792,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[],"class_list":["post-10456","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet"],"acf":[],"blog_post_summary":"<p>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. Notable Changes The JSON hub protocol now uses camel casing [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/10456","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/1235"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=10456"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/10456\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=10456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=10456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=10456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}