problemas de sincronismo

parent d68e8cca
Showing with 5 additions and 1 deletions
...@@ -144,10 +144,14 @@ io.sockets.on('connection', function (socket) { // WebSocket Connection ...@@ -144,10 +144,14 @@ io.sockets.on('connection', function (socket) { // WebSocket Connection
if (estadoPuerta == 0 && ordenRecibida == 0) console.log("La puerta ya se encuentra cerrada"); if (estadoPuerta == 0 && ordenRecibida == 0) console.log("La puerta ya se encuentra cerrada");
if (estadoPuerta == 0 && ordenRecibida == 1) { if (estadoPuerta == 0 && ordenRecibida == 1) {
abrirPuerta(); abrirPuerta();
console.log("Abriendo puerta");
setTimeout(function(){ setTimeout(function(){
cerrarPuerta(socket); cerrarPuerta(socket);
estadoPuerta = 1;
socket.broadcast.emit("actualizarEstado", Number(estadoPuerta));
socket.emit("actualizarEstado", Number(estadoPuerta));
}, 15000); }, 15000);
console.log("Abriendo puerta");
} }
if (estadoPuerta == 1 && ordenRecibida == 0) { if (estadoPuerta == 1 && ordenRecibida == 0) {
cerrarPuerta(socket); cerrarPuerta(socket);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment