Page 1 of 1

[CS:GO] How to add API in gameserver

Posted: Sat Mar 02, 2019 8:00 am
by copyerfiled
Can I make an api to the game server? To transmit data and request data in server console or plugin. Are there any ways? Ideally http json post get.

Re: [CS:GO] How to add API in gameserver

Posted: Sat Mar 02, 2019 2:47 pm
by decompile
You can, for example, make your server run sockets and requests as to your wish. (Use the unendless world of python packages)

Only downside is, that your server has to be running for this. In case its down, and you kind of want to restart it via an API, it wont work.

Re: [CS:GO] How to add API in gameserver

Posted: Sun Mar 03, 2019 2:51 am
by copyerfiled
decompile wrote:You can, for example, make your server run sockets and requests as to your wish. (Use the unendless world of python packages)

Only downside is, that your server has to be running for this. In case its down, and you kind of want to restart it via an API, it wont work.


Please tell me how I can run a process in background?

I am trying to use aiohttp, but get this error:

Code: Select all

sp plugin load api
[SP] Loading plugin 'api'...
======== Running on http://0.0.0.0:8888 ========
(Press CTRL+C to quit)
**** WARNING: Watchdog timer exceeded, aborting!
Aborted

Re: [CS:GO] How to add API in gameserver

Posted: Sun Mar 03, 2019 6:39 am
by Ayuto
You need to run it in a new thread. Otherwise you block the main thread and the server cannot run its actual logic (the game).

Re: [CS:GO] How to add API in gameserver

Posted: Mon Mar 04, 2019 6:03 am
by copyerfiled
Ayuto wrote:You need to run it in a new thread. Otherwise you block the main thread and the server cannot run its actual logic (the game).

I tried running in a separate thread. But it looks like I'm doing something wrong. Even when I tried to run an infinite loop without time.sleep, only the 1st iteration of the cycle has passed. Can you show me how to do it?

Re: [CS:GO] How to add API in gameserver

Posted: Mon Mar 04, 2019 6:22 am
by Ayuto
I think that's because the server starts hibernating. Does this also happen if you are playing on your server?