-
Notifications
You must be signed in to change notification settings - Fork 18
Write Custom Monitor v7
- 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);
});
});
Go back to the wiki Home.
Copyright (C) 2021 Stefano Balietti
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.