mqttHost method

Future<String> mqttHost()

Obtains IOT endpoint.

Returns the endpoint as a string.

Implementation

Future<String> mqttHost() async {
  final url = _urlBase.getPath(_iotBase);

  final resp = await get(url);
  final Map<String, dynamic> bodyResp =
      await JsonIsolate().decodeJson(resp.body);
  if (resp.statusCode != 200) {
    throw bodyResp['description'];
  }

  return bodyResp['mqtt_host'];
}