Here we list all API calls for the PubNub class in C#. This provides a complete Publish + Subscribe Push Notifications Framework in CSharp.
Download CSharp Push API on GitHub
Get your API keys. You only need the Publish and Subscribe Keys. Ignore the Secret Key.
Pubnub pubnub = new Pubnub( "demo", // PUBLISH_KEY "demo", // SUBSCRIBE_KEY "", // SECRET_KEY false // SSL_ON? );
// pubnub.publish( channel, message ) List<object> info = pubnub.publish( "hello_world", // Channel Name "Hi." // Message ); Console.WriteLine(info[0]); // 1 Console.WriteLine(info[1]); // 'D' or 'S' or "Error Message"
// pubnub.subscribe( channel, callback )
pubnub.subscribe(
"hello_world", // Channel Name
delegate (object message) {
Console.WriteLine(message); // Print Received Message
return true; // Keep Listening?
}
);
// pubnub.history( channel, limit ) List<object> history = pubnub.history( "hello_world", // Channel Name 1 // Limit ); Console.WriteLine(history);
That's it! Super simple, right? Download CSharp Push API on GitHub