Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send modern/Netty ping? 1.7+ status handshake ping #7

Open
deathcap opened this issue Jan 29, 2016 · 0 comments
Open

Send modern/Netty ping? 1.7+ status handshake ping #7

deathcap opened this issue Jan 29, 2016 · 0 comments

Comments

@deathcap
Copy link
Owner

The FE01 ping although called a "legacy" ping is supported on 1.4.4+ onwards, including 1.5.2, 1.6.4, and the Netty-based (protocol rewrite) Minecraft server versions 1.7.10, 1.8.9, and 1.9 snapshots — nonetheless, there is a new ping using the new Netty-ish protocol, involving some complicated encoding and STATUS handshake with a set_protocol packet.

Should node-minecraft-ping support this ping? It is already implemented and works well in https://github.com/PrismarineJS/node-minecraft-protocol/blob/master/src/ping.js

  client.once('server_info', function(packet) {
    var data = JSON.parse(packet.response);
    var start = Date.now();
    client.once('ping', function(packet) {
      data.latency = Date.now() - start;
      cb(null, data);
      client.end();
    });
    client.write('ping', {time: [0, 0]});
  });

  client.on('state', function(newState) {
    if(newState === states.STATUS)
      client.write('ping_start', {});
  });

  client.on('connect', function() {
    client.write('set_protocol', {
      protocolVersion: options.protocolVersion,
      serverHost: options.host,
      serverPort: options.port,
      nextState: 1
    });
    client.state = states.STATUS;
  });

users can just use node-minecraft-protocol instead, perhaps node-minecraft-ping could use it via node-minecraft-protocol, but this adds another dependency (for clients which will likely already have their own node-minecraft-protocol direct dependency). Not clear if it is worth it, or even worth supporting this so-called modern ping altogether. At least for what I'm interested in (https://github.com/deathcap/node-minecraft-protocol-auto automatic protocol negotiation), FE01 ping does everything I want and more.

@deathcap deathcap changed the title Send "modern" ping? 1.7+ status handshake ping Send modern/Netty ping? 1.7+ status handshake ping Jan 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant