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, void Function(NostrCountResponse countResponse)> -
This is the registry which will have all count responses callbacks.
final
-
eoseCommandCallBacks
→ Map<
String, void Function(NostrRequestEoseCommand eose)?> -
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, void Function(NostrEventOkCommand ok)?> -
This is the registry which will have all ok commands callbacks.
final
-
relaysWebSocketsRegistry
→ Map<
String, WebSocket> -
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, WebSocket> > - 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(
String subscriptionId) → void Function(NostrCountResponse countResponse)? -
Returns a count response callback from the registry with the given
subscriptionId
. -
getEoseCommandCallBack(
String subscriptionId) → void Function(NostrRequestEoseCommand eose)? -
Returns an eose command callback from the registry with the given
subscriptionId
. -
getOkCommandCallBack(
String associatedEventIdWithOkCommand) → void Function(NostrEventOkCommand ok)? -
Returns an ok command callback from the registry with the given
associatedEventId
. -
getRelayWebSocket(
{required String relayUrl}) → WebSocket? -
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(
String subscriptionId, void onCountResponse(NostrCountResponse countResponse)) → void -
Registers a count response callback to the registry with the given
subscriptionId
. -
registerEoseCommandCallBack(
String subscriptionId, void onEose(NostrRequestEoseCommand eose)?) → 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(
String associatedEventId, void onOk(NostrEventOkCommand ok)?) → void -
Registers an ok command callback to the registry with the given
associatedEventId
. -
registerRelayWebSocket(
{required String relayUrl, required WebSocket webSocket}) → WebSocket -
Registers a WebSocket to the registry with the given
relayUrl
. If a WebSocket is already registered with the givenrelayUrl
, 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