Kwwika ceased operation on 01/06/2011. Please migrate to Pusher

API‎ > ‎

JavaScript

API Documentation

The full JavaScript API documentation can be found here: Kwwika JavaScript API Docs

Examples

You can find some examples of using the JavaScript API in github:

Quick Start Guide

Include the KwwikTag

The KwwikTag is a script tag that you include in your web page to enable you to publish and subscribe to real-time data.

<script type="text/javascript" src="http://js.kwwika.com/beta/api.js"></script>

Connect

You can connect to the Kwwika service with a single call. The only requirement we have is that you have registered with us and told us that you are going to be using Kwwika from your website. You can do this by adding your website to your list of Kwwika enabled websites in the Kwwika dashboard.
1 var oConnection = kwwika.Service.connect();

Subscribe

Onces you have connected to Kwwika you can subscribe to data. We use something called a topic to identify information. For instance our example chat application uses the /KWWIKA/EXAMPLES/CHAT topic. When you subscribe to a topic you also pass an object that defines two methods. topicUpdated is called when information becomes available for the topic you've subscribed to, and topicError is called if there is a problem with your subscription such as the topic does not exist within Kwwika.

oConnection.subscribe("/KWWIKA/EXAMPLES/CHAT",

              {

                  topicUpdated: function(oSubscription, mUpdate)

                  {

                      // handle update

                  },

                  topicError: function(oSubscription, sReason)

                  {

                      // handle error

                  }

              });

Publish

We've tried to keep publishing data as simple as possible. All you need to do is specify the topic you want to publish to, the names and values that you want to publish, and provide an object that will be informed about whether your attempt to publish succeeded or not.

oConnection.publish("/KWWIKA/EXAMPLES/CHAT",

            {

                name: "Kwwika",

                text: "Hello, world!"

            },

            {

                commandSuccess: function(sTopicName)

                {

                    // handle success

                },

                commandError: function(sTopicName, sReason)

                {

                    // handle error

                }

            });
If you are publishing larger amounts of information or you want to publish information from an existing system then it's unlikely that the JavaScript Kwwika API is the right API for you. We've also got APIs available in Java, C, .NET and Silverlight so please get in touch if you would like more information.
Subpages (1): How to...

Sign in  |  Recent Site Activity  |  Terms  |  Report Abuse  |  Print page  |  Powered by Google Sites