observe method
Observe
Implementation
Future<CoapObserveClientRelation> observe(
final CoapRequest request, {
final int maxRetransmit = 0,
}) async {
request
..observe = ObserveRegistration.register.value
..maxRetransmit = maxRetransmit;
final responseStream = _sendWithStreamResponse(request).asBroadcastStream();
final relation = CoapObserveClientRelation(request, responseStream);
unawaited(
() async {
final resp = await _waitForResponse(request, responseStream);
if (!resp.hasOption<ObserveOption>()) {
relation.isCancelled = true;
}
}(),
);
return relation;
}