node.js - SocketCluster - pass variable to emit event -


var socketcluster = require('socketcluster-client'); // ..... // .....  var scsocket = [];  (var k = 0; k < 32; k++) {   scsocket[k] = socketcluster.connect(options);   scsocket[k].on('connect', function (status) {       this.emit("auth", api_credentials, function (err, token) {                console.log(k); // output 32 , exit                process.exit();       });    }); } 

how can pass variable k emit function of scsocket client in right way : https://socketcluster.io/#!/docs/api-scsocket-client ?


Comments

Popular posts from this blog

php - Embed BBCode within itself not working -

three.js - how to load gltf in three JS -

sql server - T-SQL: Access DB objects in same schema without qualifying? -