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

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -