Shinigami Hooks
useLocalPeer

useLocalPeer

The useLocalPeer hook allows you to interact with your own Peer object, which is how you are represented inside a Huddle01 room.

const {
    peerId,
    metadata,
    permissions,
    updateMetadata,
  } = useLocalPeer({
    onMetadataUpdated(metadata) {},
  });

Props

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

1. onMetadataUpdatedOptionalAdvanced
DescriptionReturn Type
This function will be called when the metadata associated with you is updated.void
Parameter NameTypeDescriptionRequired
metadataunknownThe metadata associated with your peer object.Yes
Example Usage
const localPeer = useLocalPeer({ onMetadataUpdated: (metadata) => {
	console.log("Your metadata was updated!");
	console.log(metadata);
    // your code here
}});

Returns

The useLocalPeer hook returns an object with the following fields.

1. peerIdObject
DescriptionType
Your peerId.string | null
2. metadataObjectAdvanced
DescriptionType
The metadata associated with you.unknown
3. permissionsObject
DescriptionType
Your peer permissions inside the room.TPermissions
4. updateMetadataFunction
DescriptionReturn Type
Update the metadata associated with your peer object.void
Parameter NameTypeDescriptionRequired
dataunknownThe metadata you want to be associated with your peer object.Yes
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.