Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 20th, 2012  |  syntax: None  |  size: 0.31 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //code - node.js w/socket.io
  2.  
  3. clients = io.of('/client').on('connection', function(socket) {
  4.  
  5.         var id = "";
  6.  
  7.         socket.on('info', function(data) {
  8.                 id = data.id;
  9.                 console.log("Inside the function: #"+id);
  10.         });
  11.  
  12.         console.log("Outside the function: #"+id);
  13.  
  14. //result
  15. >>Outside the function: #
  16. >>Inside the function: #5555