Skip to main content

Function: usePeers()

usePeers<PeerMetadata, ServerMetadata>(): object

Hook that provides live updates of room peers.

Type Parameters

Type ParameterDefault typeDescription
PeerMetadata extends GenericMetadataGenericMetadataType for peer-specific metadata
ServerMetadata extends GenericMetadataGenericMetadataType for server-specific metadata

Returns

object

localPeer

localPeer: null | PeerWithTracks<PeerMetadata, ServerMetadata>

The local peer with distinguished tracks (camera, microphone, screen share). Will be null if the local peer is not found.

peers

peers: Peer<PeerMetadata, ServerMetadata>[]

Deprecated

Use localPeer and remotePeers instead Legacy array containing all peers (both local and remote) without distinguished tracks. This property will be removed in future versions.

remotePeers

remotePeers: PeerWithTracks<PeerMetadata, ServerMetadata>[]

Array of remote peers with distinguished tracks (camera, microphone, screen share).

Defined in

packages/react-native-client/src/hooks/usePeers.ts:165