Because i want to return it in the function getdata() by :
responseObj.json(resp_);
My issues is that i can't get the variable resp_ from the socket.on !!
This is my code :
function getData(responseObj) {
// ..more code..
io.sockets.on('connection', function (socket) {
io.emit('resp',response);
});
io.sockets.on('connection', function (socket) {
socket.on('resp_',function(resp_){
socket.on('IOTdata_', function(IOTdata_){
resp_.categories.push({"label": IOTdata_.date});
// resp_.dataset[0].data.push({"value" : IOTdata_.temperature});
// resp_.dataset[1].data.push({"value" : IOTdata_.humidity});
// console.log(resp_);
});
});
});
responseObj.json(resp_);
}); }
via Hassen Dakhlaoui
No comments:
Post a Comment