Hi Kai,
Just to clarify, it's not possible to subscribe to the main REST items list (global), or to subscribe to a single REST item state? I'm trying to modify the GreenT app to at least test binding to something but my Js is terrible.
I snagged what I think are the first steps with GreenT from the forum and while it says the websocket connection was successful to a single item, I can't get the response body to show up. :(
I'm using the subscribe function from GreenT and trying to display the response in the console (to start) but all I get is [object Object]. Given your earlier response I can put al objects one one sitemap (if that was what you meant) or change the server as needed, but I would really like to query the server via websockets (long-polling etc) and as the item updates, change the HTML display.
My changes to the GreenT snippet,
function Request(item) {
this.socket = $.atmosphere;
this.subSocket;
this.transport = 'websocket';
this.request = { url: 'ws://
192.168.1.13:8080/rest/items/' + item,
maxRequest : 256,
timeout: 59000,
attachHeadersAsQueryString : true,
executeCallbackBeforeReconnect : false,
contentType : "text/plain",
logLevel : 'debug',
transport : 'websocket' ,
fallbackTransport: 'long-polling',
headers: {'Accept': 'application/json',
'X-Atmosphere-tracking-id': '1234'}};
this.request.onOpen = function(response) {
$('body').append('<p>Atmosphere connected using ' + response.transport + '</p>');
console.log('Server: ' + response);
};
Any tips would be greatly appreciated.
-J