Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
wss.on('connection', function(new_websocket_connection) {
var ws = websocket_stream(new_websocket_connection);
var loggingIn = true;
//ws.write('OK', {binary: true});
var mc = minecraft_protocol.createClient({
version: FIXED_MC_VERSION,
host: argv.mchost,
port: argv.mcport,
username: argv.prefix + userIndex,
password: null});
autoVersionForge(mc);
userIndex += 1;
ws.on('close', function() {
console.log('WebSocket disconnected, closing MC');
if (mc.socket) mc.socket.end();
});
ws.on('error', function(err) {
console.log('WebSocket error: ',err);