Shinigami Hooks
useRemotePeer

useRemotePeer

The useRemotePeer hook allows you to interact with another user's Peer object, which is how they are represented inside a Huddle01 room.

const {
    peerId,
    metadata,
  } = useRemotePeer({
    peerId: "remote-peer-id",
    onMetadataUpdate(data) {},
  });

Props

The useRemotePeer hook accepts an object with the following fields as props.

1. peerIdRequired
DescriptionType
The peerId of the remote peer.string
Example Usage
const remotePeer = useRemotePeer({ peerId: "remote-peer-id" });
2. onMetadataUpdatedOptionalAdvanced
DescriptionReturn Type
This function will be called when the metadata associated with the remote peer is updated.void
Parameter NameTypeDescriptionRequired
data{ metadata: unknown }An object containing the metadata associated with the remote peer object.Yes
Example Usage
const remotePeer = useRemotePeer({ peerId: "remote-peer-id", onMetadataUpdated: (data) => {
	console.log("Remote peer's metadata was updated!");
	console.log(data.metadata);
    // your code here
}});

Returns

The useLocalPeer hook returns an object with the following fields.

1. peerIdObject
DescriptionType
The remote peer's peerId.string | undefined
2. metadataObjectAdvanced
DescriptionType
The metadata associated with the remote peer.unknown
Audio/Video Infrastructure designed for the developers to empower them ship simple yet powerful Audio/Video Apps.
support
company
Copyright © 2022 Graphene 01, Inc. All Rights Reserved.