getRelayInfo method

  1. @override
Future<RelayInfo?> getRelayInfo(
  1. String url
)
override

network request to get the RelayInfo of the relay at url; returns null when it is unavailable

Implementation

@override
Future<RelayInfo?> getRelayInfo(String url) async {
  try {
    final json = await httpDS.jsonRequest(
      url,
      timeout: timeout,
      headers: const {'Accept': 'application/nostr+json'},
    );
    return RelayInfo.fromJson(
      json,
      Uri.parse(url).replace(scheme: 'https').toString(),
    );
  } catch (e) {
    Logger.log.d(() => e);
    return null;
  }
}