getRandomPresences (48)
Finalized
The getRandomPresences message is a request for a random sample of active presences of a particular type. This is a key mechanism for network discovery, allowing a new or isolated node to find a set of initial peers to connect to without needing a hardcoded list.
Core Data Types
char: See Global Serialization Rules.
Payload Structure
| Field | Data Type | Min | Max | Description |
|---|---|---|---|---|
nodeType | char | 1 | 1 | A single character representing the desired node type (M, H, R, C). |
Behavioral Notes
- Purpose: This message is a tool for peer discovery and bootstrapping. A node sends it to find a random set of other nodes to connect to.
- Response Mechanism: There is no unique response message for
getRandomPresences. Instead, a node receiving this request will respond by sending a series ofupdatePresencemessages back to the requester. - Response Logic:
- The receiving node queries its local
PresenceListfor up to 20 presences matching the requestednodeType. - If more than 10 presences are found, it selects a random subset of 10.
- For each
Presenceobject in the final selection, it sends one or moreupdatePresencemessages to the requester. (A singlePresencemight be split into multiple chunks/messages if it's very large).
- The receiving node queries its local
- The requester should be prepared to receive multiple
updatePresencemessages in response to a singlegetRandomPresencesrequest.