Skip to main content

Configuration

src/server/Server.server.luau
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Loren = require(ReplicatedStorage.Shared.Loren)

Loren.Configure({
DefaultTimeout = 15,
ForwardErrors = "Never",
})

Loren.AddServices(script.Parent.Services)
Loren.SetOnFire():expect()

Every key has a default, so you only set what you want to change.

How Configure works​

  • Call it before SetOnFire. After that, it raises an error.
  • You can call it more than once. Each call merges its keys into the settings so far.
  • Every key in a call is checked before any is applied. An unknown key, a wrong type or a value out of range raises an error at your line and changes nothing. A key with the wrong capitalization gets a suggestion.
  • Numbers must be finite. math.huge and NaN are refused.
  • Most keys are server keys. Set them in your server script. The server sends the limits clients need, so clients follow them without being told. A server key set on a client is ignored, with a warning in Studio.
  • A few keys work on both sides and apply to the side that sets them. PromiseTraces is client only.

Every key​

Rate limits (server)​

Each player gets these budgets. Clients hold themselves to MirrorFraction of each one, so an honest client slows down on its own before the server would have to refuse anything. What happens when a limit is hit is on the Security page.

KeyDefaultAllowedWhat it limits
FrameRate120a number above 0Remote fires per second from one player, per channel (reliable and unreliable each).
FrameBurst140a number, 1 or moreRemote fires a player can send in a quick burst.
ByteRate131072a number above 0Bytes per second from one player, both channels (128 KiB).
ByteBurst262144a number, 1 or moreBytes in a quick burst (256 KiB).
MessageRate600a number above 0Calls and events per second from one player.
MessageBurst600a number, 1 or moreCalls and events in a quick burst.
MethodRate50a number above 0Calls per second to one Client method, per player.
MethodBurst100a number, 1 or moreCalls to one Client method in a quick burst.
EventRate75a number above 0Fires per second of one reliable ClientEvent, per player.
EventBurst150a number, 1 or moreThe same, in a quick burst.
UnreliableEventRate120a number above 0Fires per second of one unreliable ClientEvent, per player.
UnreliableEventBurst60a number, 1 or moreThe same, in a quick burst.
MirrorFraction0.9above 0, up to 1The share of each limit clients hold themselves to.

Rates refill continuously. A burst is how many you can spend at once before the rate applies.

Calls (server)​

KeyDefaultAllowedWhat it does
DefaultTimeout101 to 120 seconds, rounded to 0.1How long a client waits for a reply before Timeout, for methods without their own.
MaxRunningCalls32an integer, 1 or moreCalls per player whose handler yielded and is still running.
MaxQueuedCalls64an integer, 0 to 1024Calls per player waiting behind those. Past this, calls get Busy.
MaxZombies16an integer, 1 or moreCalls per player that passed their deadline while the handler kept running. Past this, methods holding one get Busy.
MaxZombiesPerRoute4an integer, 1 or moreThe same, for one method. A method at this count gets Busy.
SerialQueue8an integer, 0 to 1024Calls per player waiting on one Serial method.
MaxPending256an integer, 1 to 4096Calls one client can have waiting for a reply. Past this, TooManyInFlight.
WatchdogGrace50 to 30 secondsOnce a call's timeout plus this has passed, the server stops tracking it and frees its slot.
CancelOnTimeoutfalsea booleanAt that point, cancel the handler's thread instead of letting it run to the end.

Signals (server)​

KeyDefaultAllowedWhat it does
Backlog64an integer, 0 to 1024Messages kept per Signal on a client until its first Connect. 0 turns the backlog off, as in 1.5.1.
BacklogWindow10an integer, 0 to 255 secondsHow long after the client is ready it keeps backlogs for Signals nobody connected to.

Errors and safety (server)​

KeyDefaultAllowedWhat it does
ForwardErrors"Studio""Studio", "Never" or "Always"When clients see the text of a server error. "Studio" sends it only in Studio. "Always" gets a boot warning.
KickScorefalsefalse or a number above 0Kick a player whose violation score reaches this number. Off by default.
MiddlewareArityChecktruea booleanLook for colon-style middleware at boot. See Middleware.

Boot (both sides)​

KeyDefaultAllowedWhat it does
StrictCyclesfalsea booleanA dependency cycle fails the boot.
CycleWarningsfalsea booleanList allowed dependency cycles in the boot warnings.
IgniteTimeoutfalsefalse or seconds above 0A LorenIgnite (setup hook) still running after this long fails the boot. With false, Loren only warns.

Encoding and debugging​

KeySideDefaultAllowedWhat it does
InlineTablesbothtruea booleanfalse sends every table through Roblox's own remote serialization, as 1.5.1 did, instead of Loren's compact form. It costs more bytes. Use it to rule Loren's encoding out when you chase a bug.
PromiseTracesclient"Studio""Studio", "Always" or "Never"Record where each call was made, so an unhandled rejection warning points at your line. "Studio" does it only in Studio.

Members (server)​

Members overrides options for one Client method or ClientEvent, by "Service.Member" name:

OverrideAllowedApplies to
RateLimit{ rate, burst }, rate above 0, burst 1 or moreMethods and ClientEvents
Timeout1 to 120 seconds, rounded to 0.1Methods
Seriala booleanMethods
CancelOnTimeouta booleanMethods
AllowNonFinitea booleanMethods and ClientEvents

An override that doesn't apply to the member's kind is ignored. Members never applies to Signals. A name that matches no Client method or ClientEvent is a boot warning, with a suggestion.

For each option, the first of these that sets it wins:

  1. Members["Service.Member"]
  2. the member's Spec (see Typed specs)
  3. your Configure default, like MethodRate or DefaultTimeout
  4. Loren's default

Checks at boot​

When the server boots, it checks that clients can always get their largest message through:

  • ByteBurst * MirrorFraction must be at least 131072. A client's heaviest single send costs about 70 KB against the byte budget.
  • FrameBurst * MirrorFraction must be at least 1.
  • MessageBurst * MirrorFraction must be at least 1.

If one fails, the boot fails and the report shows the number it got.

Examples​

A live game that keeps error text private, kicks clients that keep sending garbage, and won't hang on a stuck LorenIgnite:

src/server/Server.server.luau
Loren.Configure({
ForwardErrors = "Never",
KickScore = 100,
IgniteTimeout = 15,
})

Each violation adds 2 to 10 points to a player's score, and the score drops by 1 point a second. Violations are packets an unmodified client doesn't send, so honest players shouldn't collect any.

Different limits for a few members:

src/server/Server.server.luau
Loren.Configure({
Members = {
["ShopService.Buy"] = { RateLimit = { 2, 5 }, Serial = true },
["ReportService.Export"] = { Timeout = 60 },
["CombatService.Aim"] = { RateLimit = { 30, 30 } },
},
})

Client settings go in the client script:

src/client/Client.client.luau
Loren.Configure({
PromiseTraces = "Always", -- point unhandled rejections at your line, outside Studio too
StrictCycles = true, -- fail the client boot on a Controller cycle
})