PlayerTarget
What a function takes where it wants a player: the PlayerSnapshot or the player’s ID. Pass the snapshot when you can: it reaches only the connection it came from, while an ID reaches whoever has it now.
Definition
Section titled “Definition”type PlayerTarget = number | PlayerSnapshot;Values
Section titled “Values”| Value | Type | Means |
|---|---|---|
a PlayerSnapshot |
PlayerSnapshot |
That player’s connection. A function whose player left meanwhile returns { status: "rejected", code: "session-ended" } or stale-target. |
a number |
number |
The player with that ID now. 0 means everyone, where a function says so. |
Related
Section titled “Related”- Async handlers: why the snapshot is safer