respondToRequests

Responds to incoming requests by updating the request list locally and notifying the server of the request status. This function is typically used to manage permissions or participation requests in real-time collaboration tools.

Parameters:

  • options (RespondToRequestsOptions): Contains the following:

  • socket: An instance of the socket connection used to communicate with the server.

  • request: The request to respond to, containing fields like id, name, and icon.

  • updateRequestList: A callback function to update the list of pending requests.

  • requestList: The current list of requests.

  • action: The action to perform in response to the request (e.g., "accept" or "reject").

  • roomName: The name of the room in which the response should be processed.

Example:

respondToRequests(
RespondToRequestsOptions(
socket = socket,
request = Request(id = "123", name = "John Doe", icon = "fa-microphone"),
updateRequestList = { newList -> setState { requests = newList } },
requestList = requests,
action = "accept",
roomName = "conferenceRoom"
)
)

Workflow:

  1. Filters out the specified request from requestList.

  2. Updates the list of requests locally using updateRequestList.

  3. Sends the response to the server by emitting updateUserofRequestStatus.

This ensures both the local UI and the server stay in sync regarding the request's status.