C# implementation of the Pusher REST API
C#
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
PusherRESTDotNet.Tests
PusherRESTDotNet
lib
.gitignore
PusherRESTDotNet.1.2.dotCover
PusherRESTDotNet.sln
README.md

README.md

THIS PROJECT IS DORMANT, PLEASE USE https://github.com/leggetter/pusher-dotnet-server INSTEAD

The Pusher REST .NET project is implementation of the Pusher REST API in C#.

It provides functionality to let you trigger events using the Pusher REST API in addition to authenticating user subscription request to private and presence channels.

Trigger events

Events can be triggered with any type of data which is then serialized to JSON.

var provider = new PusherProvider(applicationId, applicationKey, applicationSecret);
var request = new ObjectPusherRequest("test_channel", "my_event", new
																	{
																		some = "data"
																	});

provider.Trigger(request);

Authenticate Private Channels

Assuming that the running application is an ASP.NET app then the private channels are authenticated using the IPusherProvider.Authenticate method with the values for the channel name and the socket ID retrieved from the Request object.

var provider = new PusherProvider(appId, appKey, appSecret);
string auth = provider.Authenticate(Request["channel_name"], Request["socket_id");
Response.Write(auth);

Authenticate Presence Channels

Presence channels are authenticated in much the same way as private channels. The only difference is that the channel data must also be passed to the IPusherProvider.Authenticate method so that it can be hashed within the authentication string.

var provider = new PusherProvider(appId, appKey, appSecret);
string auth = provider.Authenticate(Request["channel_name"], Request["socket_id");
Response.Write(auth);