@epicgames-ps/lib-pixelstreamingsignalling-ue5.5 / PlayerRegistry / PlayerRegistry
PlayerRegistry.PlayerRegistry
Handles all the player connections of a signalling server and can be used to lookup connections by id etc. Fires events when players are added or removed. Events: 'added': (playerId: string) Player was added. 'removed': (playerId: string) Player was removed.
-
EventEmitter↳
PlayerRegistry
• new PlayerRegistry(): PlayerRegistry
EventEmitter.constructor
▸ add(player): void
Assigns a unique id to the player and adds it to the registry
| Name | Type |
|---|---|
player |
IPlayer |
void
▸ count(): number
Gets the total number of connected players.
number
▸ empty(): boolean
Returns true when the registry is empty.
boolean
▸ get(playerId): undefined | IPlayer
Gets a player from the registry using the player id. Returns undefined if the player doesn't exist.
| Name | Type |
|---|---|
playerId |
string |
undefined | IPlayer
▸ has(playerId): boolean
Tests if a player id exists in the registry.
| Name | Type |
|---|---|
playerId |
string |
boolean
▸ listPlayers(): IPlayer[]
IPlayer[]
▸ remove(player): void
Removes a player from the registry. Does nothing if the id does not exist.
| Name | Type |
|---|---|
player |
IPlayer |
void