Skip to content

Commit

Permalink
Handle no scale
Browse files Browse the repository at this point in the history
  • Loading branch information
hakanensari committed Mar 5, 2013
1 parent 77558e6 commit 9ccc9dd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/cargo
Expand Up @@ -5,7 +5,11 @@ var io = require('socket.io').listen(8080)
, fs = require('fs');

io.sockets.on('connection', function(socket) {
setInterval(function() { socket.emit('scale', scale.poll().value) }, 250);
setInterval(function() {
if(res = scale.poll()) {
socket.emit(res.value);
}
}, 250);

socket.on('printer', function(data) {
var path = '/tmp/' + new Date().getTime();
Expand Down

0 comments on commit 9ccc9dd

Please sign in to comment.