wait function
Implementation
Future<dynamic> wait(List<String> topics,
{bool sticky = true, Duration? timeout}) async {
var stream = subscribe(topics).stream;
if (timeout != null) {
stream = stream.timeout(timeout, onTimeout: (EventSink ev) {
ev.close();
});
}
await for (Message msg in stream) {
if (!sticky && msg.sticky) continue;
return msg.data;
}
throw (TimeoutException('Timeout on wait function'));
}