Server Command Throttle

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Void*
Posts: 75
Joined: 15 Feb 2021, 13:49

Server Command Throttle

Postby Void* » 24 Nov 2022, 16:12

Is there a built-in way to throttle the number of requests to the server?

For example; in our game it is physically impossible to send more than a few requests from the client per 100ms via normal player interaction. If this rate is breached, I want to kick the offending user (as it's likely a bot).

Can this be done?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Server Command Throttle

Postby Lapo » 25 Nov 2022, 08:36

Hi,
yes under the Flood Filter in the Zone Configurator of the AdminTool.
Here you can add a custom rate limiter for every request, with the Exception of Extensions requests.

Extension requests are a different story because the server doesn't know what they do and thus limiting them with a global cap would likely break some game logic.

For Extensions you should implement a custom throttle, based on your needs.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Void*
Posts: 75
Joined: 15 Feb 2021, 13:49

Re: Server Command Throttle

Postby Void* » 25 Nov 2022, 10:46

For Extensions you should implement a custom throttle, based on your needs.


Just to confirm, is this done via a Filter? Does SFS2X have any foundation classes for this or is it ground-up work? Either answer is ok, I just want to be sure before I start work on it :)
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Server Command Throttle

Postby Lapo » 25 Nov 2022, 20:47

It's not done via a filter. Filters exist for "system" requests but not for Extensions calls.

One way to introduce a request limiter is via a base class common to all your Extension's request handlers.
The base class could implement the logic for keeping track of each request rate (per user) and then each request handler could inherit from that class and invoke that logic before executing any other code.

I think it could also be implemented at a more lower level in the API by us and be generic enough to satisfy most use cases, but we'd need a deeper investigation.
It's good you brought this up :) I've added a link to this post in our todo/feature list do we revisit this topic for a future release.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
Void*
Posts: 75
Joined: 15 Feb 2021, 13:49

Re: Server Command Throttle

Postby Void* » 26 Nov 2022, 20:39

Aha, this makes perfect sense.

Thank you!

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 58 guests