getAuthTokenByRoomCode method
getAuthTokenByRoomCode is used to get the authentication token to join the room using room codes.
This returns an object of Future
Implementation
Future<dynamic> getAuthTokenByRoomCode(
{required String roomCode, String? userId, String? endPoint}) async {
var arguments = {
"room_code": roomCode,
"user_id": userId,
"end_point": endPoint
};
var result = await PlatformService.invokeMethod(
PlatformMethod.getAuthTokenByRoomCode,
arguments: arguments);
//If the method is executed successfully we get the "success":"true"
//Hence we pass the String directly
//Else we parse it with HMSException
if (result["success"]) {
return result["data"];
} else {
return HMSException.fromMap(result["data"]["error"]);
}
}