Universal Messaging 10.7 | Developer Guide | Web Client APIs | Web Developer's Guide for Javascript | Web Client Development in JavaScript | Publish/Subscribe Tasks | DataStream - Receiving DataGroup Events
 
DataStream - Receiving DataGroup Events
JavaScript clients can (optionally) act as a DataStream, which allows them to receive events from DataGroups of which they are made members.
The process for enabling DataStream functionality is quite simple:
1. Pass a configuration object to the Nirvana.createSession() call with a suitable configuration parameter (enableDataStreams).
2. Implement the Session.on() callback function.
Processing events received as a DataStream is also very simple:

var mySession = Nirvana.createSession({ enableDataStreams : true });

function myDGEventHandler(event) {
console.log("Received a DataGroup Event");
}

mySession.on(Nirvana.Observe.DATA, myDGEventHandler);

mySession.start();
Note that JavaScript clients can only act as DataStreams (consumers of DataGroup events). The JavaScript API does not currently support publishing to DataGroups or remote management of DataGroup members; DataGroup management is instead supported by Universal Messaging's Enterprise APIs.