NostrRegistry class

This is responsible for registering and retrieving relays WebSockets that are connected to the app.

Annotations
  • @protected

Constructors

NostrRegistry({required NostrClientUtils utils})
This is responsible for registering and retrieving relays WebSockets that are connected to the app.

Properties

countResponseCallBacks Map<String, SubscriptionCallback<NostrCountResponse>>
This is the registry which will have all count responses callbacks.
final
eoseCommandCallBacks Map<String, SubscriptionCallback<NostrRequestEoseCommand>>
This is the registry which will have all eose responses callbacks.
final
eventsRegistry Map<String, NostrEvent>
This is the registry which will have all events.
final
hashCode int
The hash code for this object.
no setterinherited
okCommandCallBacks Map<String, SubscriptionCallback<NostrEventOkCommand>>
This is the registry which will have all ok commands callbacks.
final
relaysWebSocketsRegistry Map<String, WebSocketChannel>
This is the registry which will have all relays WebSockets.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
utils NostrClientUtils
final

Methods

allRelaysEntries() List<MapEntry<String, WebSocketChannel>>
Returns all WebSockets registered in the registry.
clearAllRegistries() → void
Clears all registries.
clearWebSocketsRegistry() → void
Clears the events registry.
eventUniqueId(NostrEvent event) String
REturns an event unique id, See also NostrEvent.uniqueKey.
getCountResponseCallBack({required String subscriptionId, required String relay}) → (void Function(String relay, NostrCountResponse countResponse)?)
Returns a count response callback from the registry with the given subscriptionId.
getEoseCommandCallBack({required String subscriptionId, required String relay}) → (void Function(String relay, NostrRequestEoseCommand eose)?)
Returns an eose command callback from the registry with the given subscriptionId.
getOkCommandCallBack({required String associatedEventIdWithOkCommand, required String relay}) → (void Function(String relay, NostrEventOkCommand ok)?)
Returns an ok command callback from the registry with the given associatedEventId.
getOrCreateRegister<T>(RelayCallbackRegister<T> register, String relay) SubscriptionCallback<T>
getRelayWebSocket({required String relayUrl}) → WebSocketChannel?
Returns the WebSocket registered with the given relayUrl.
isEventRegistered(NostrEvent event) bool
Wether an event is registered with the given event.
isRelayRegistered(String relayUrl) bool
Wether a WebSocket is registered with the given relayUrl.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerCountResponseCallBack({required String subscriptionId, required void onCountResponse(String relay, NostrCountResponse countResponse), required String relay}) → void
Registers a count response callback to the registry with the given subscriptionId.
registerEoseCommandCallBack({required String subscriptionId, required void onEose(String relay, NostrRequestEoseCommand eose), required String relay}) → void
Registers an eose command callback to the registry with the given subscriptionId.
registerEvent(NostrEvent event) NostrEvent
Registers an event to the registry with the given event.
registerOkCommandCallBack({required String associatedEventId, required void onOk(String relay, NostrEventOkCommand ok), required String relay}) → void
Registers an ok command callback to the registry with the given associatedEventId.
registerRelayWebSocket({required String relayUrl, required WebSocketChannel webSocket}) → WebSocketChannel
Registers a WebSocket to the registry with the given relayUrl. If a WebSocket is already registered with the given relayUrl, it will be replaced.
toString() String
A string representation of this object.
inherited
unregisterRelay(String relay) bool
Removes an event from the registry with the given event.

Operators

operator ==(Object other) bool
The equality operator.
inherited