A Moderator can designate a connected Participant to act as a Moderator during the session. Doing so, the promoted Participant would get access to all the rights of the Moderator, i.e. access all features listed under Moderator Controls; and the old Moderator becomes a Participant. Similarly, the new Moderator can further grant Moderator Role to other participant if needed.

Method: switchUserRole (clientId )

Parameter:

  • @param {String} clientId – Client ID of the participant who is being designated as a Moderator

Event Listeners:

  • onSwitchedUserRole – Moderator is acknowledged that he has requested for Switch User Role
  • onUserRoleChanged – All participants are notified with a message that a new user has been appointed as moderator. Also, the newly appointed moderator is notified with extra information
// To enable stats
window.EnxRtc.switchUserRole(clientId);

// Add Event Listeners
// Moderator is acknowledged
window.EnxRtc.addEventListner("onSwitchedUserRole", function
(data)
{
console.log(JSON.stringify(data.data));
});

// Client whose role is changed from participant to moderator.
window.EnxRtc.addEventListner("onUserRoleChanged",function (data)
console.log(JSON.stringify(data.data));
});