[CS:GO] How to add API in gameserver

All other Source.Python topics and issues.
User avatar
copyerfiled
Junior Member
Posts: 14
Joined: Wed Jan 23, 2019 9:40 am

[CS:GO] How to add API in gameserver

Postby copyerfiled » Sat Mar 02, 2019 8:00 am

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.
decompile
Senior Member
Posts: 356
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

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

Postby decompile » Sat Mar 02, 2019 2:47 pm

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.
User avatar
copyerfiled
Junior Member
Posts: 14
Joined: Wed Jan 23, 2019 9:40 am

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

Postby copyerfiled » Sun Mar 03, 2019 2:51 am

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
User avatar
Ayuto
Project Leader
Posts: 1947
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

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

Postby Ayuto » Sun Mar 03, 2019 6:39 am

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).
User avatar
copyerfiled
Junior Member
Posts: 14
Joined: Wed Jan 23, 2019 9:40 am

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

Postby copyerfiled » Mon Mar 04, 2019 6:03 am

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?
User avatar
Ayuto
Project Leader
Posts: 1947
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

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

Postby Ayuto » Mon Mar 04, 2019 6:22 am

I think that's because the server starts hibernating. Does this also happen if you are playing on your server?

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 5 guests