Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var coins =[];
  2. io.sockets.on("connection", function(socket) {
  3.    
  4.     setInterval( ()={
  5.              getCoinsData(function(error, data) {
  6.                  if (error) {
  7.                      return console.log(error);
  8.                 }
  9.                 coins = data;
  10.                 socket.emit('message', data);
  11.             });
  12.  
  13.          }, 10000);
  14.     socket.on("getMycoins",()=>{
  15.         socket.emit("coins_list",coins);       
  16.     })
  17.    
  18. })
  19. /*          client */
  20.  
  21.  
  22. socket.on("connect",()=>{
  23.     socket.on("coins_list",()=>{
  24.         draw coins table
  25.     })
  26. })
  27.  
  28. setInterval( ()=>{
  29.     socket.emit("getMycoins")
  30. },1500)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement