This commit is contained in:
2015-06-05 10:07:46 +02:00
parent c09e26c103
commit 8fc57cc92e
13113 changed files with 1068470 additions and 864281 deletions
@@ -10,13 +10,14 @@ define([
}));
var _updateSocketOpened = false;
var _updateSocket = new Socket({
url: config.hos.deviceRepoUrl,
url: config.hos.deviceRepoUrl + '?onevent=changes&clientid=1234',
headers: {
"On-Event": "changes",
"Connection-Timeout": 60000,
"Client-Id": 1234
},
transport: xhr.get });
transport: xhr.post });
_updateSocket = Observable(_updateSocket);
_updateSocket.on("open", function(event){
_socketOpened = true;
console.log("Socket Opened ", event.message);
@@ -38,5 +39,17 @@ define([
}
console.log("Message: " + data);
});
_store.sendCommand = function(id, cmd) {
console.log("ToDo: send command", cmd ,"to " + id);
var devurl = config.hos.deviceRepoUrl + "/" + id + "?method=command&value=" + encodeURIComponent(JSON.stringify(cmd));
xhr.get({url: devurl}).then(function(data){
// Do something with the handled data
}, function(err){
// Handle the error condition
}, function(evt){
// Handle a progress event from the request if the
// browser supports XHR2
});
};
return _store;
});