Open ECEstal opened 12 months ago
function rconCall(rconCMD,callback){ var conn = new Rcon((process.env.Global_IP),(process.env.ASA_rcon_port),(process.env.ASA_password),rconoptions);
conn.on('auth', function() {
conn.send(rconCMD);
}).on('response', function(rconInfo) {
console.log("Response: " + rconInfo);
conn.emit('end');
return callback(rconInfo);
}).on('error', function(err) {
console.log("Error: " + err);
}).on('end', function() {
conn.disconnect();
});
conn.connect();
};
rconCall("GetChat",function(response){ Some code that uses your response here });
Is it possible to save the value of the on('response') to a variable I can pull after conn.connect(), so that it can be passed over as a return value?
There's an example of what I'd like to do.