Handles the response to a participant in the waiting room, either allowing or denying their entry.
Options for handling the participant's entry request.
Unique identifier for the participant.
Name of the participant.
Function to update the waiting list by removing the responded participant.
Current list of participants in the waiting room.
Indicates whether to allow ("true") or deny ("false") the participant's entry.
The name of the room the participant is requesting to join.
The socket instance used to emit the response event.
Resolves when the response has been processed.
const respondService = new RespondToWaiting();respondService.respondToWaiting({ participantId: '12345', participantName: 'John Doe', updateWaitingList: (newList) => console.log('Updated Waiting List:', newList), waitingList: currentWaitingList, type: 'true', roomName: 'Room1', socket: io('http://localhost:3000'),}); Copy
const respondService = new RespondToWaiting();respondService.respondToWaiting({ participantId: '12345', participantName: 'John Doe', updateWaitingList: (newList) => console.log('Updated Waiting List:', newList), waitingList: currentWaitingList, type: 'true', roomName: 'Room1', socket: io('http://localhost:3000'),});
In this example, the participant 'John Doe' is allowed to join 'Room1', and the updated waiting list is logged.
Responds to a participant waiting to join a room by either allowing or denying their entry.
The options for responding to the waiting participant.
Handles the response to a participant in the waiting room, either allowing or denying their entry.
Param: options
Options for handling the participant's entry request.
Param: options.participantId
Unique identifier for the participant.
Param: options.participantName
Name of the participant.
Param: options.updateWaitingList
Function to update the waiting list by removing the responded participant.
Param: options.waitingList
Current list of participants in the waiting room.
Param: options.type
Indicates whether to allow ("true") or deny ("false") the participant's entry.
Param: options.roomName
The name of the room the participant is requesting to join.
Param: options.socket
The socket instance used to emit the response event.
Returns
Resolves when the response has been processed.
Example
In this example, the participant 'John Doe' is allowed to join 'Room1', and the updated waiting list is logged.