Provides information about remote event push mechanism through WebSocket.
Example
The example below demonstrates the implementation of Websocket remote event over JavaScript:
var url="ws://mprm.foo.com/remote/events/my_event_topic/?filter=(my.event.property=some_value)&gatewayID=myDeviceIDvar socket = new WebSocket(url);socket.onmessage = function(event) { console.log('event: ' + event); console.log('event-data: ' + event['data']); //.... parse the JSON content of the event data and process it .....}The following JavaScript establishes a connection to RM and subscribes for events coming from device with ID myDeviceId and having org/osgi/framework/BundleEvent/STARTED topic (firing events when new bundles are started):
topic = "org/osgi/framework/BundleEvent/STARTED";var ws = new WebSocket('ws://127.0.0.1:1505/remote/events/' + topic + '/?gatewayID=myDeviceID');ws.onopen=function(){alert("You are subscribed to "+topic);}ws.onmessage = function(msg){msgJSON = JSON.parse(msg.data) // The bundle.symbolicName property key contains "." character so we cannot access it with dot notation. alert("Bundle started: "+msgJSON.properties["bundle.symbolicName"]);}