joinRoomClient

Joins a room by emitting the joinRoom or joinConRoom event to the server using the provided socket.

This function uses JoinRoomClientOptions as input, selecting joinRoom if consume is false and joinConRoom if consume is true. It returns a ResponseJoinRoom object containing data from the server. If the process fails, an error is thrown and a message is logged in debug mode.

Example Usage:

val options = JoinRoomClientOptions(
socket = socketInstance,
roomName = "meeting123",
islevel = "1",
member = "user123",
sec = "abc123",
apiUserName = "user123",
consume = true
)

try {
val response = joinRoomClient(options)
} catch (error: Exception) {
Logger.e("JoinRoomClient", "Error joining room: $error")
}

In this example:

  • The function attempts to join meeting123 using joinConRoom (since consume is true).

  • If successful, it prints the roomId from ResponseJoinRoom. If not, it catches and logs the error.