GETTING STARTED
REALTIME FUNCTIONALITY WITH PUSHER.COM

WebSockets is a new protocol within the HTML5 standard, it allows user interfaces (clients) to have information pushed to them in realtime, rather than periodically polling a webservice.

HTML5 websockets is not widely implemented on browsers at this stage, but the pusher.com service can be used as an alternative and also add value beyond native websockets.

The mydigitstructure platform has been integrated with the pusher.com service to make it easy to add realtime functionality to an application.

The generic mydigitalstructure notification channel is available or set up your own pusher channel (similar to how oauth services like facebook and twitter are integrated).

With your own account you then have full control over the data and how it is sent, channel configuration and more.  If you are passing sensitive information in the actual message - then you need to encrypt it or set up a private channel - see pusher.com for more information.

SET UP

1 Set up your account with pusher.com.

Sign up
2 The pusher.com will set up 3 keys for you:
# Consumer key
# Consumer secret
# Application ID

You then need to use:

/ondemand/setup/?method=SETUP_URL_MANAGE&type=12&urllogon=[Consumer key]&urlpassword=[Consumer secret]&private=N&title=Pusher
&url=http://api.pusherapp.com/apps/[Application ID]/channels/[channel]/events


These application credentials will be used automatically when sending data via pusher.com

USER INTERFACE

You can use pusher.com to listen to your channels in many types of clients, eg webbrowser, iOS, Andriod etc

jQuery Example:

Reference:
http://js.pusher.com/1.11/pusher.min.js
or /jscripts/pusher.1.11.min.js

var pusher = new Pusher([Consumer Key]);
var channel = pusher.subscribe('test_channel');
    channel.bind('my_event', function(data) {
      alert(data);
    });

SENDING DATA

To send data to clients in realtime using pusher.com, use:

/ondemand/network/?method=NETWORK_WEBSOCKET_MANAGE&function=my_event&message=Hello World!

 

pusher.com