Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 1.35 KB

README.md

File metadata and controls

35 lines (25 loc) · 1.35 KB

Pusher.Connections.SocketRocket

Pusher.NET implementation using SocketRocket for Xamarin.iOS.

Motivation

We use Xamarin.iOS for developing Mural.ly iOS App, we use Pusher on our Architecture and we needed to connect on the iOS App. We took the great transport agnostic implementation from Pusher.NET and the C# bindings of SocketRocket and put together a library.

SocketRocket is a WebSocket Implementation for iOS created by the Square Team.

Usage

var factory = new Pusher.Connections.SocketRocket.WebsocketConnectionFactory();
this.pusher = new Pusher.Pusher(factory, "you-pusher-api-key", new Options
{
    Authenticator = // any IAuthenticator if private channels needed
});

await this.pusher.ConnectAsync();
this.channel = (Channel)await pusher.SubscribeToChannelAsync("your-channel-name");

this.channel.EventEmitted += async (sender, e) =>
{
    if (e.EventName == "pusher_internal:subscription_succeeded")
    {
      Console.WriteLine(e.Data) // Get the event data
    }
};

Copyright

This is work in progress created by @leChantux, @juliracca, @johnnyhalife