.
This commit is contained in:
@@ -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;
|
||||
});
|
||||
Reference in New Issue
Block a user