Class RpcGate
- Namespace
- Unity.Multiplayer.Core
The engine-free checks every generated RPC stub runs before calling the game's handler: on the server, a ToServerAttribute call must come from the entity's owner (when required) and be within the sender's rate; on a client, a server-to-client call must come from the server.
public sealed class RpcGate
- Inheritance
-
RpcGate
- Inherited Members
Remarks
One gate per server session; the adapter keeps it with the session and forgets a sender when it leaves.
Constructors
RpcGate()
A gate with its own, empty rate limiter.
public RpcGate()
RpcGate(RpcRateLimiter)
A gate over limiter.
public RpcGate(RpcRateLimiter limiter)
Parameters
limiterRpcRateLimiter
Exceptions
- ArgumentNullException
limiteris null.
Properties
Limiter
The per-sender buckets behind RateLimit.
public RpcRateLimiter Limiter { get; }
Property Value
Methods
CheckFromServer(ulong)
Decides one incoming server-to-client call: it must come from the server.
public static RpcVerdict CheckFromServer(ulong sender)
Parameters
senderulong
Returns
CheckToServer(string, bool, ulong, ulong, bool, int, int, double)
Decides one incoming ToServerAttribute call.
public RpcVerdict CheckToServer(string rpc, bool isServer, ulong sender, ulong owner, bool requireOwnership, int rateLimit, int burst, double now)
Parameters
rpcstringThe RPC key (declaring type and method name).
isServerboolTrue when this process is the server.
senderulongThe calling client id.
ownerulongThe entity's owner client id.
requireOwnershipboolThe RPC's RequireOwnership.
rateLimitintThe RPC's RateLimit; 0 for none.
burstintThe RPC's Burst; 0 for one second's worth.
nowdoubleThe current time in seconds.
Returns
Remarks
The server itself (ServerClientId, which on a host is also the host's own player) passes the ownership check: the authority may always act. Ownership is checked before the rate, so a refused non-owner spends none of the owner's budget.
Clear()
Forgets everything (the session ended).
public void Clear()
Forget(ulong)
Forgets a sender's rate buckets (it disconnected).
public void Forget(ulong sender)
Parameters
senderulong