How to use the minecraft-protocol/src.createClient function in minecraft-protocol

To help you get started, we’ve selected a few minecraft-protocol examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deathcap / wsmc / wsmc.js View on Github external
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);