This is a library to ping both
The library uses a significant portion of both mc-ping-updated and mcpe-ping. Thanks to both of you for the base code.
I've essentially just cleaned up a few bits, converted all parameters to a single object, somewhat standardized the response, and made it use promises instead of callbacks.
As said prior, all parameters are just a single object passed as the only argument.
Valid parameters are
server (the hostname/ip),
port (the port, duh),
timeout (time in ms for the ping to time out),
type (if not using
protocol (protocol version to use if pinging PC).
server is required, and
type defaults to pc.
const ping = ;// PE Ping;// PC Ping;// Also a PC pingping;
For both PC and PE, a successful resolution will pass a JSON object as documented here: http://wiki.vg/Server_List_Ping#Response
PE does not have a few fields that PC does, such as the favicon. However,
description exist for both PC and PE, to provide a somewhat consistent format to find player counts across the two platforms.