How do I interact with a newly created server created with child_process.spawn

I am trying to create an frontend for my privately hosted Counter-Strike Global Offensive servers, on the frontend when I find the launch server everything works fine and the server starts up and logs to the console. But how can I view information like server IP, players on the server and other things?

This is what I have used so far to start the server:

router.post('/create', function(req, res) {
    console.log(req.body);
    var child = spawn('/home/steam/steamcmd/csgo/srcds_run -game csgo -console +game_type 0 +game_mode 0 +host_workshop_collection 249376192 -tickrate 128 +maxplayers 20')
    child.stderr.on('data', function(err) {
        console.log(err);
    });
    child.stdin.on('data', function(chunk) {
        console.log(chunk);
    });
    child.stdout.on('data', function(chunk) {

    });

});

      

Like, for example, if I was using a paid server server, I would have a control panel where I could see the server IP, restart / stop watching players in the game, and other things. Hope this was clear enough and sorry if it's poorly written. I'm not sure how else to say this.

+3


source to share


1 answer


Does the server accept input after it starts up? If possible, you can write with

child.stdin.write('my command\n');

      



Otherwise, you will have to request it using something like gamedig

+3


source







All Articles