sendCountEventToRelays method
Future<void>
sendCountEventToRelays(
- NostrCountEvent countEvent, {
- required void onCountResponse(
- String relay,
- NostrCountResponse countResponse
- List<
String> ? relays,
override
Implementation
@override
Future<void> sendCountEventToRelays(
NostrCountEvent countEvent, {
required void Function(String relay, NostrCountResponse countResponse)
onCountResponse,
List<String>? relays,
}) async {
await _registerNewRelays(relays ?? relaysList!);
final serialized = countEvent.serialized();
_runFunctionOverRelationIteration((relay) {
final relayUrl = relay.url;
if (relays?.containsRelay(relayUrl) ?? true) {
_registerOnCountCallBack(
subscriptionId: countEvent.subscriptionId,
onCountResponse: onCountResponse,
relay: relayUrl,
);
relay.socket.sink.add(serialized);
utils.log(
'Count Event with subscription id: ${countEvent.subscriptionId} is sent to relay with url: ${relay.url}',
);
}
});
}