Last active
August 29, 2015 14:04
-
-
Save desireesantos/22c90bda6d19927a82a4 to your computer and use it in GitHub Desktop.
Módulo responsável por gerenciar socket
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ws = require('ws'); | |
exports.create = function () { | |
machine = new Machine(name,status); | |
ws.callSocket(machine.status); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var io ; | |
module.exports = function (http) { | |
io = require('socket.io')(http); | |
console.log('Start connection') | |
getSocket(0); | |
} | |
exports.callSocket = function(status){ | |
getSocket(status); | |
} | |
function getSocket (level) { | |
io.on('connection', function (client) { | |
console.log('Sending data ...') | |
client.emit('coffee:level', level); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment