This is the 15th in series of posts leading up Node.js Knockout, and covers using PubNub in your node app.

PubNub lets you connect mobile phones, tablets, web browsers and more with a 2 Function Publish/Subscribe API (send/receive).

HTML Interface

If you are building HTML5 Web Apps, start by copying and pasting the code snippet below. If not, skip to Other Languages.

<div pub-key="demo" sub-key="demo" id="pubnub"></div>
<script src=""></script>

    // Listen For Events
        channel  : "hello_world",      // Channel
        error    : function() {        // Lost Connection (auto reconnects)
            alert("Connection Lost. Will auto-reconnect when Online.")
        callback : function(message) { // Received An Event.
        connect  : function() {        // Connection Established.

            // Send Message
                channel : "hello_world",
                message : { anything : "Hi from PubNub." }



Other Languages

Follow the instructions linked below to use PubNub APIs from other programming languages: Node, Ruby, PHP, Python, Perl, Erlang and more programming languages on GitHub.

Blog comments powered by Disqus