Browse Source

fixed io.sockets bug

Bachir Soussi Chiadmi 4 months ago
parent
commit
70fca92f32
1 changed files with 1 additions and 1 deletions
  1. 1 1
      nodejs-express/server.js

+ 1 - 1
nodejs-express/server.js

@@ -27,7 +27,7 @@ io.on('connection', (socket) =>{
     // calculate the new number
     num = data.num+1;
     // renvoyer a tous les client l'info du changement
-    socket.broadcast.emit('change_num', {'num':num});
+    io.sockets.emit('change_num', {'num':num});
   });
 })