Properly set up websockets
This commit is contained in:
parent
fa53720e17
commit
f423758310
|
@ -122,10 +122,10 @@
|
|||
_ref = [req.params.robotid, req.params.deviceid], robotid = _ref[0], deviceid = _ref[1];
|
||||
return master.findRobotDevice(robotid, deviceid, function(err, device) {
|
||||
if (err) {
|
||||
res.io.respond(err);
|
||||
req.io.respond(err);
|
||||
}
|
||||
return device.on('update', function(data) {
|
||||
return res.io.respond({
|
||||
return req.io.emit('update', {
|
||||
data: data
|
||||
});
|
||||
});
|
||||
|
|
|
@ -86,5 +86,6 @@ namespace "Api", ->
|
|||
[robotid, deviceid] = [req.params.robotid, req.params.deviceid]
|
||||
|
||||
master.findRobotDevice robotid, deviceid, (err, device) ->
|
||||
res.io.respond(err) if err
|
||||
device.on 'update', (data) -> res.io.respond { data: data }
|
||||
req.io.respond(err) if err
|
||||
device.on 'update', (data) ->
|
||||
req.io.emit 'update', { data: data }
|
||||
|
|
Loading…
Reference in New Issue