useRoomMetadata
The useRoomMetadata hook returns the metadata associated with the room and the function to update it.
| Name | Description | Return Type | Params |
|---|---|---|---|
| metadata | The room metadata | unknown | |
| updateMetadata | Updates the room metadata | void | metadata: unknown |
Example Usage
const {
roomData,
updateMetadata,
} = useRoomMetadata<{title: string}>({
onMetadataUpdated(metadata:unknown) {},
onLeave(data: {
reason: 'LEFT' | 'CLOSED' | 'KICKED' | 'DENIED';
message?: string;
}) {}
});
const updateMetadata = () => {
updateMetadata({
string: "Huddle01 Room"
});
}Props
The useRoomMetadata hook accepts an object with the following fields as props.
onMetadataUpdated
Optional
| Description | Type |
|---|---|
| This function will be called when the room metadata gets updated. | void |
Example Usage
const devices = useRoomMetadata({ onMetadataUpdated:() => {
console.log("Triggered when metadata updated")
}});onLeave
Optional
| Description | Type |
|---|---|
| This function will be called when the peer leaves. | void |
Example Usage
const devices = useRoomMetadata({ onLeave:() => {
console.log("Triggered when peer leaves")
}});