Write Custom Monitor v7 - nodeGame/nodegame GitHub Wiki

  • status: incomplete
  • version: 7.x

The nodeGame servers can be controlled and queried via messages.

Some of the commands accepted by the AdminServer include:

  • SERVERCOMMAND_ROOMCOMMAND
    Instructs clients in a room to be setup, started, paused, resumed or stopped.
  • SERVERCOMMAND_INFO
    Queries the server for information about channels, rooms, clients or games.
  • SERVERCOMMAND_STARTBOT
    Starts a PhantomJS instance connected to the server, using clientType 'autoplay'.

For more information, refer to the implementation of AdminServer.

Examples:

// Pause all players in a given room.
node.socket.send(node.msg.create({
    target: 'SERVERCOMMAND',
    text:   'ROOMCOMMAND',
    data: {
        type:    'PAUSE',
        roomId:  roomId,  // roomId must be defined
        doLogic: false,
        clients: 'players',
        force:   false
    }
}));

// Start a PhantomJS bot.
node.socket.send(node.msg.create({
    target: 'SERVERCOMMAND',
    text:   'STARTBOT'
}));

// Get a list of channels.
node.socket.send(node.msg.create({
    target: 'SERVERCOMMAND',
    text:   'INFO',
    data: {
        type:      'CHANNELS',
        extraInfo: true
    }
}));
// Listen for the response.
node.on.data('INFO_CHANNELS', function(msg) {
    Object.keys(msg.data).forEach(function(channel) {
        console.log(msg.data[channel].name);
    });
});
⚠️ **GitHub.com Fallback** ⚠️