Pusher .NET Server Library v4.1.0

pusher-net-server-library-v4-1-0-header.jpg

We’ve just released a new version of the .NET Server Library, supporting .NET Core and the asynchronous programming features of .NET 4.5.

Introduction

We’ve just released a new version of the .NET Server Library, supporting .NET Core and the asynchronous programming features of .NET 4.5.

This library release introduces potentially breaking changes so we’ve incremented the version number to v4.1.0.

BREAKING CHANGE: Asynchronous Syntax

We’ve changed the previous callback syntax used for asynchronous programming to use the more modern async / await approach from .NET 4.5+.

This means that you can now use the Pusher .NET library asynchronously using the following code style:

1using PusherServer;
2
3var pusher = new Pusher(APP_ID, APP_KEY, APP_SECRET);
4
5Task<ITriggerResult> resultTask = pusher.TriggerAsync( "my-channel", "my-event", new { message = "hello world" } );
6
7// You can do work here that doesn't rely on the result of TriggerAsync  
8DoIndependentWork();
9
10ITriggerResult result = await resultTask;

For more examples see the Readme or the docs.

This also means that the v4.1.0 library is only officially compatible with .NET 4.5 and above (including .NET Core). If you need to support older versions of the .NET framework then you have two options:

Please note that neither of these workarounds will be officially supported by Pusher.

Support for .NET Core

The library now supports .NET Core which means it can be built for any platform with a .NET Core implementation.

We still support standard .NET builds as well, so there are now three separate solutions in this repository:

  • pusher-dotnet-server for the standard .NET library
  • pusher-dotnetcore-server for the .NET Core compatible library
  • pusher-dotnet-everything-server to build both libraries

The NuGet package contains both the .NET Core and .NET 4.5 compatible libraries.

Other Fixes

  • We fixed an issue with channel name exceptions where the message was being used as the parameter name.
  • We merged in a PR fixing a thread-safety issue (thanks Brandon)

Thanks to John McLoughlin for his work on this release.