updateMetadata<T> method
void
updateMetadata<T>(
- T data
Send Message to update the metadata of the Local Peer
NOTE: This will notify every user in the room about the metadata update
Implementation
void updateMetadata<T>(T data) {
try {
if (!checkPermission(
permissionTypeCheck: PermissionType.canUpdateMetadata,
)) {
return;
}
if (!joined) {
logger.e('❌ Cannot Update Metadata, You have not joined the room yet');
return;
}
final peerId = this.peerId;
if (peerId == null) {
logger.e('❌ Cannot Update Metadata, PeerId Not Found');
return;
}
final newMetadata = jsonEncode(data);
socket.publish(Request_Request.updatePeerMetadata, {
'peerId': peerId,
'metadata': newMetadata,
});
} catch (error) {
logger.e('🔔 Error Updating Metadata $data | error: $error');
}
}