C# Push API

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.

Initialize

	Pubnub pubnub = new Pubnub(
		"demo",  // PUBLISH_KEY
		"demo",  // SUBSCRIBE_KEY
		"",      // SECRET_KEY
		false    // SSL_ON?
	);

Publish

	// 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"

Subscribe

	// pubnub.subscribe( channel, callback )
	pubnub.subscribe(
		"hello_world", // Channel Name
		delegate (object message) {
			Console.WriteLine(message); // Print Received Message
			return true;                // Keep Listening?
		}
	);

History

	// 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