Class RemoveParticipants

Removes a participant from the room if the user has the appropriate permissions.

This method checks the current user's level and their co-host responsibilities to determine if they are allowed to remove a specified participant. If allowed, the method emits a socket event to disconnect the participant and updates the local list of participants. If not allowed, an alert is displayed.

The options for removing a participant.

The responsibilities of the co-host.

The participant to be removed.

The current member attempting to remove the participant.

The level of the current member.

Optional function to show alert messages.

The co-host information.

The list of current participants.

The socket instance for emitting events.

The name of the room.

Function to update the participants list.

A promise that resolves when the participant is removed.

Will log an error if there is an issue accessing co-host responsibilities.

const removeParticipantsService = new RemoveParticipants();
await removeParticipantsService.removeParticipants({
coHostResponsibility: [{ name: 'participants', value: true }],
participant: { id: '123', name: 'John', islevel: '1' },
member: 'Alice',
islevel: '1',
showAlert: ({ message, type }) => {
console.log(`Alert: ${message} - Type: ${type}`);
},
coHost: 'Bob',
participants: [{ id: '123', name: 'John', islevel: '1' }],
socket: socketInstance,
roomName: 'room1',
updateParticipants: (updatedList) => {
console.log('Updated participants:', updatedList);
},
});

Constructors

Methods

Constructors

Methods

MMNEPVFCICPMFPCPTTAAATR