quickDiscoverClients method
Implementation
Stream<DiscoveredClient> quickDiscoverClients(
{Duration? timeout = const Duration(seconds: 5),
Duration? searchInterval = const Duration(seconds: 10),
String? query,
bool unique = true}) async* {
if (_sockets.isEmpty) {
await start(port: 0);
}
final seen = <String?>{};
if (timeout != null) {
search(query);
Future.delayed(timeout, () {
stop();
});
} else if (searchInterval != null) {
search(query);
_discoverySearchTimer = Timer.periodic(searchInterval, (_) {
search(query);
});
}
await for (var client in clients) {
if (unique && seen.contains(client.usn)) {
continue;
}
seen.add(client.usn);
yield client;
}
}