Networking
Use namespaced JSON messages with host-resolved callers and bounded transport policy.
Message contract
| Type or member | Contract |
|---|---|
LitherarpAddonNetworkDirection | Flags: ClientToHost, HostToClient, Both. |
LitherarpAddonNetworkOptions.MaxPayloadBytes | Receiver limit, clamped from 1 to 16,384 UTF-8 bytes. Default 4,096. |
MaxCallsPerWindow | Per-caller host limit, clamped from 1 to 100. Default 20. |
RateLimitWindowSeconds | Window clamped from 0.25 to 60 seconds. Default 5. |
PermissionNode | Optional local node resolved as addon.<id>.<node> on every client-to-host message. |
LitherarpAddonNetworkMessageContext | AddonId, MessageName, cloned JSON Payload, nullable Caller, nullable host-resolved Player, and TryRead<T>. |
Request and response
Host validation
For client-to-host traffic, the platform validates addon id, message name, registered direction and a positive caller Steam id first. It then spends the caller's rate-limit token and checks any configured permission before measuring or parsing the JSON. Malformed traffic cannot avoid throttling. The client cannot supply Caller or Player.
A message without PermissionNode can run before pawn creation. In that case Caller is set and Player is null. A permission-gated message requires an existing pawn because the host must evaluate addon.<id>.<node> for that player. Use SendNetworkToConnection to answer an active connection before its pawn exists, and SendNetworkToPlayer after it does.
Host-to-client traffic is accepted only from the host RPC path. On a listen server, direct delivery uses the same registered handler.
Limits and failures
- At most 64 distinct message names per addon.
- Message names are at most 48 characters and are normalized to lowercase. Allowed characters are ASCII letters, digits, dot, underscore and hyphen.
- The sender-wide serialization ceiling is 16,384 UTF-8 bytes. The receiver can set a lower limit.
- Three consecutive recoverable handler failures quarantine that handler for the activation.
- Nested synchronous dispatch is rejected after a depth of eight.
- All payloads must be JSON serializable. A false return means registration, validation or send failed.
A custom addon [Rpc.Host] method does not inherit these caller, permission, payload and rate checks. Use the addon network service unless you implement every guard yourself.