pub struct PresenceClient { /* private fields */ }Expand description
Handle to the presence relay connection.
Implementations§
Source§impl PresenceClient
impl PresenceClient
Sourcepub fn connect(
relay: String,
world_id: String,
passport: String,
spawn: Option<String>,
) -> Self
pub fn connect( relay: String, world_id: String, passport: String, spawn: Option<String>, ) -> Self
Connect to a single relay for world_id. Convenience over [connect_any].
Sourcepub fn connect_any(
relays: Vec<String>,
world_id: String,
passport: String,
spawn: Option<String>,
) -> Self
pub fn connect_any( relays: Vec<String>, world_id: String, passport: String, spawn: Option<String>, ) -> Self
Connect to the first reachable relay in relays (primary first, then
fallbacks — no single relay is a point of failure). Non-blocking: the socket
runs on a background thread; if none is reachable, the world degrades to solo.
pub fn is_connected(&self) -> bool
Sourcepub fn drain(
&self,
presence: &mut PresenceState,
now_ms: u64,
) -> Vec<TravelerHello>
pub fn drain( &self, presence: &mut PresenceState, now_ms: u64, ) -> Vec<TravelerHello>
Apply all received traveler events to the presence set (stamping arrival
time now_ms so interpolation shares the world clock). Returns the
identities announced this drain, so the caller can fetch their
descriptors and upgrade their look from the placeholder.
Sourcepub fn send_pose(&self, pos: Vec3, rot: Quat, vel: Vec3, anim: u8)
pub fn send_pose(&self, pos: Vec3, rot: Quat, vel: Vec3, anim: u8)
Send the local player’s pose (dropped if the outbound queue is full).
Sourcepub fn send_voice(&self, frame: Vec<u8>)
pub fn send_voice(&self, frame: Vec<u8>)
Send one voice frame (raw PCM16 payload, presence-wire §6). Dropped if the queue is full — voice is realtime; late frames are worthless.