discover method

Future<Iterable<CoapWebLink>?> discover({
  1. String query = '',
})

Discovers remote resources.

Implementation

Future<Iterable<CoapWebLink>?> discover({
  final String query = '',
}) async {
  final discover = CoapRequest.newGet()
    ..uriPath = CoapConstants.defaultWellKnownURI;
  if (query.isNotEmpty) {
    discover.uriQuery = query;
  }
  final links = await send(discover);
  if (links.contentFormat != CoapMediaType.applicationLinkFormat) {
    return <CoapWebLink>[CoapWebLink('')];
  } else {
    return CoapLinkFormat.parse(links.payloadString);
  }
}