Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Pull request Compare This branch is 1 commit ahead, 1239 commits behind pubnub:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

..
Failed to load latest commit information.
Pubnub.cs
Pubnub.exe
Pubnub.exe.mdb
Pubnub2.cs
PubnubAsync.cs
PubnubCustomer.cs
PubnubCustomer.exe
PubnubCustomer.exe.mdb
README
System.Runtime.Serialization.Json.dll
System.Runtime.Serialization.Json.xml
System.Web.Extensions.dll
System.Web.Extensions.xml
customer-api-build
mono-build
mono-build-asyc
mono-build-async

README

## ---------------------------------------------------
## UPDATE! UPDATE! UPDATE! UPDATE!
## ---------------------------------------------------
##
## ---------------------------------------------------
## If you are looking for an Asynchronous C# API:
## https://github.com/pubnub/pubnub-api/tree/master/silverlight
## ---------------------------------------------------
##
## ---------------------------------------------------
## Use the Silverlight C# API when you need
## NON-Blocking Publish/Subscribe APIs.
## ---------------------------------------------------
## 
## ---------------------------------------------------
## Improved 3rd Party API:
## https://github.com/pressf12/pubnub
## ---------------------------------------------------
## 
## ---------------------------------------------------
##
## YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API.
## http://www.pubnub.com/account
##
## ----------------------------------------------------

## ----------------------------------------------
## PubNub 3.0 Web Data Push Cloud-Hosted API - C#
## ----------------------------------------------
##
## www.pubnub.com - PubNub Web Data Push Service in the Cloud. 
## http://www.pubnub.com/tutorial/csharp-push-api
##
## PubNub is a Massively Scalable Web Push Service for Web and Mobile Games.
## This is a cloud-based service for broadcasting messages
## to thousands of web and mobile clients simultaneously.

## -------------------------------------------
## ARE YOU COMPILING WITH .NET OLDER THAN 3.5?
## -------------------------------------------
## YOU MUST USE System.Web.Extensions.dll included in this directory.

===============================================================================
PubNub C# Client API Boiler Plate
===============================================================================

-------------------------------------------------------------------------------
JavaScript: (Subscribe)
-------------------------------------------------------------------------------

    PUBNUB.subscribe( { channel : "hello_world" } , function(message) {
        console.log(JSON.stringify(message));
        alert(JSON.stringify(message));
    } );


-------------------------------------------------------------------------------
C#: (Init)
-------------------------------------------------------------------------------

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


-------------------------------------------------------------------------------
C#: (Publish)
-------------------------------------------------------------------------------

    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"


-------------------------------------------------------------------------------
C#: (Subscribe)
-------------------------------------------------------------------------------

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


-------------------------------------------------------------------------------
C#: (History)
-------------------------------------------------------------------------------

    List<object> history = pubnub.History( "hello_world", 1 );
    foreach (object history_message in history) {
        Console.Write("History Message: ");
        Console.WriteLine(history_message);
    }

Something went wrong with that request. Please try again.