i don't know if its a good idea running a flask app inside my csgo server but if its possible how would i do that?
i was also looking at sanic framework which use asyncio. any ideas?
Thanks.
trying to make a rest api service inside of csgo server
Re: trying to make a rest api service inside of csgo server
Yes, it's possible. iPlayer already did this with his MODT Player library:
viewtopic.php?f=38&t=1515
viewtopic.php?f=38&t=1515
Re: trying to make a rest api service inside of csgo server
Well, MOTDPlayer doesn't start web-server inside of the game server, this stuff is handled from outside.
What I'd suggest you to look is SP-CCP. This way you'll be able to connect a web-server with the game-server.
As for asyncio... It's possible to launch a uWSGI in asyncio+greenlet mode. Then you install Flask there, and with a tiny workaround it's possible to call awaitable coroutines from the regular Flask views. That can go very handy with websockets as the view won't be terminated immediately, but instead you can await for incoming data there.
If you were talking about Source.Python + asyncio, I've had an idea, but he haven't discussed that yet.
What I'd suggest you to look is SP-CCP. This way you'll be able to connect a web-server with the game-server.
As for asyncio... It's possible to launch a uWSGI in asyncio+greenlet mode. Then you install Flask there, and with a tiny workaround it's possible to call awaitable coroutines from the regular Flask views. That can go very handy with websockets as the view won't be terminated immediately, but instead you can await for incoming data there.
If you were talking about Source.Python + asyncio, I've had an idea, but he haven't discussed that yet.
/id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.
Re: trying to make a rest api service inside of csgo server
Why not directly make a web server instead of websockets??
edit:
or maybe i cloud just use redis to put everything i need as cache and then get it using any web app.
but what a bout pubsub thing? instead of websockets?
edit:
or maybe i cloud just use redis to put everything i need as cache and then get it using any web app.
but what a bout pubsub thing? instead of websockets?
Re: trying to make a rest api service inside of csgo server
SP-CCP doesn't involve websockets in any way.
Though connecting web-server with a game-server via websockets is also an option (that was proposed by Doldol).
There's no way a pure-pythonic web-server would handle the load as good as, say, nginx or Apache. Making the game-server responsible for the stuff it shouldn't be responsible (like serving static files) is not a way to go. Think of DDoS on your web port.
As for Redis, that's also an option for syncing the web- and game-servers. But I dunno, isn't that an overkill to use a pub-sub system just to exchange the data between two servers?
Though connecting web-server with a game-server via websockets is also an option (that was proposed by Doldol).
There's no way a pure-pythonic web-server would handle the load as good as, say, nginx or Apache. Making the game-server responsible for the stuff it shouldn't be responsible (like serving static files) is not a way to go. Think of DDoS on your web port.
As for Redis, that's also an option for syncing the web- and game-servers. But I dunno, isn't that an overkill to use a pub-sub system just to exchange the data between two servers?
/id/its_iPlayer
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.
My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.
Return to “General Discussion”
Who is online
Users browsing this forum: No registered users and 31 guests