lib/client.js
/**
     * This sends commands to the RCON server. If an error occurred (ie authentication error) it
     * will reject with the same response packet.
     * @param {string} cmd
     * @returns {Promise<RCONPacket>}
     */
This sends commands to the RCON server. If an error occurred  it
will reject with the same response packet.
@param {string} cmd
@returns {Promise}
This sends commands to the RCON server . If an error occurred it will reject with the same response packet . @param { string } cmd @returns { Promise }
command(cmd) {
        return new Promise((resolve, reject) => {
            const encoded = Client.encode(PacketType.SERVERDATA_EXECCOMMAND, 53, cmd);
            this.client.once('data', (chunk) => {
                const decoded = Client.decode(chunk);
                if (decoded.type != PacketType.SERVERDATA_RESPONSE_VALUE)
                    reject(decoded);
                else
                    resolve(decoded);
            });
            this.client.write(encoded);
        });
    }
command ( cmd ) { return new Promise ( ( resolve , reject ) => { const encoded = Client . encode ( PacketType . SERVERDATA_EXECCOMMAND , 53 , cmd ) ; this . client . once ( 'data' , ( chunk ) => { const decoded = Client . decode ( chunk ) ; if ( decoded . type != PacketType . SERVERDATA_RESPONSE_VALUE ) reject ( decoded ) ; else resolve ( decoded ) ; } ) ; this . client . write ( encoded ) ; } ) ; }
This sends commands to the RCON server.
This sends commands to the RCON server .