Hi,
i hope i have choose the right community to offer my problem.
Actually i try to subscribe a item State with atmosphere.js (Websocket)
My problem is the onMessage-Function is called every time even if no item state is changed.
Can someone help me to fix my problem?
Build #657
Example code:
var socket = require('atmosphere.js');
var headers = {};
headers["Accept"] = "application/json";
var oldState = '';
var request = {
url: 'http://localhost:8080/rest/items/hue_0200_0017882d39af_3_color',
contentType : "application/json",
transport: 'websocket',
headers: headers,
attachHeadersAsQueryString: true
};
request.onMessage = function (response) {
var message = response.responseBody;
var obj = JSON.parse(message);
console.log("State changed to");
console.log(obj.state);
};
var subSocket = socket.subscribe(request);
Thank you. Regards
Karotte