updateRole method
Update the role of the Remote Peer in the Room, this will emit an event updated
with the updated role.
Implementation
void updateRole(Map<String, dynamic> data) {
try {
if (!joined) {
throw Exception(
"β Cannot Update Role, You have not joined the room yet",
);
}
if (data['role'] == role) {
logger.w('π Peer Role is already set to ${data['role']}');
return;
}
if (peerId == null) {
logger.e(
'β Cannot Update Role, PeerId Not Found (You have not joined the room yet)',
);
return;
}
socket.publish(Request_Request.updatePeerRole, {
'peerId': peerId,
'role': data['role'],
});
} catch (error) {
logger.e('π Error Updating Role $data | error: $error');
}
}