Client

Note: Make sure you've setup the helper before starting with this.

Ratchet's client is a simple wrapper around Autobahn adding some handy functionality. Such as auto-connecting on page load, resubscrining after reconnect and onconnect/onhangup events.

Pub/Sub

The examples below are usage examples, for a more detailed article about Autobahns pub/sub workings check here.

Subscribing

cakeWamp.subscribe('Plugin.TopicName', function(topicUri, event) {
	// Do your stuff
});

Publishing

cakeWamp.publish('Plugin.TopicName', {
	type: 'eventObject'
});

Unsubscribing

cakeWamp.unsubscribe('Plugin.TopicName');

RPC

cakeWamp.call('Plugin.TopicName', {
	type: 'eventObject'
});

Events

Onconnect

cakeWamp.onconnectListeners.push(function(session) {
	console.log('Connected!');
});

Onhangup

cakeWamp.onhangupListeners.push(function(session) {
	console.log('Poof!');
});