Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // from the game instance
- const master = new TLSClient({
- options: {
- ca: fs.readFileSync(config.API_CERT),
- },
- reconnectInterval: 2000,
- host: config.MASTER_API_HOST,
- port: config.MASTER_API_PORT,
- password: config.API_PASSWORD
- })
- master.on('authenticated', () => {
- syncListing()
- })
- master.on('message', message => { ... })
- master.on('close', () => { ... })
- master.on('error', err => { ... })
- function syncListing() {
- master.send({
- type: 'list',
- listing: {
- version: config.GAME_VERSION,
- port: 8001,
- currentPlayers: 0, // these would be variables
- maxPlayers: 100,
- mode: 'idle',
- etc: 'anything'
- }
- })
- }
- function updatePlayerCount() {
- master.send({
- type: 'list',
- listing: {
- currentPlayers: 10
- }
- })
- }
Add Comment
Please, Sign In to add comment