Manages nostr content retrieval system

Hierarchy

  • EventEmitter<NostrSystemEvents>
    • NostrSystem

Implements

Constructors

  • Parameters

    • props: NostrsystemProps

    Returns NostrSystem

Properties

#log: Debugger = ...
#queryManager: QueryManager
checkSigs: boolean

Check event signatures (reccomended)

eventsCache: FeedCache<NostrEvent>
optimizer: Optimizer

Optimizer instance, contains optimized functions for processing data

pool: ConnectionPool
profileCache: FeedCache<CachedMetadata>

Storage class for user profiles

profileLoader: ProfileLoaderService

Profile loading service

relayCache: FeedCache<UsersRelays>

Storage class for user relay lists

relayLoader: RelayMetadataLoader
relayMetricsCache: FeedCache<RelayMetrics>

Storage class for relay metrics (connects/disconnects)

relayMetricsHandler: RelayMetricHandler

Relay metrics handler cache

prefixed: string | boolean

Accessors

Methods

  • Send an event to all permanent connections

    Parameters

    • ev: NostrEvent

      Event to broadcast

    • Optional cb: ((rsp) => void)

      Callback to handle OkResponse as they arrive

    Returns Promise<OkResponse[]>

  • Parameters

    • address: string

    Returns Promise<undefined | Connection>

  • Create a new permanent connection to a relay

    Parameters

    • address: string

      Relay URL

    • options: RelaySettings

      Read/Write settings

    Returns Promise<void>

  • Disconnect permanent relay connection

    Parameters

    • address: string

      Relay URL

    Returns void

  • Fetch data from nostr relays asynchronously

    Parameters

    • req: RequestBuilder

      Request to send to relays

    • Optional cb: ((evs) => void)

      A callback which will fire every 100ms when new data is received

    Returns Promise<TaggedNostrEvent[]>

  • Get an active query by ID

    Parameters

    • id: string

      Query ID

    Returns undefined | QueryLike

  • Do some initialization

    Returns Promise<void>

  • Connect to a specific relay and send an event and wait for the response

    Parameters

    • address: string

      Relay URL

    • ev: NostrEvent

      Event to send

    Returns Promise<OkResponse>

  • Type Parameters

    • T extends keyof NostrSystemEvents

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<NostrSystemEvents>[Extract<T, keyof NostrSystemEvents>]

          Returns void

    • Optional context: any

    Returns this

  • Calls each of the listeners registered for a given event.

    Type Parameters

    • T extends keyof NostrSystemEvents

    Parameters

    • event: T
    • Rest ...args: ArgumentMap<NostrSystemEvents>[Extract<T, keyof NostrSystemEvents>]

    Returns boolean

  • Return an array listing the events for which the emitter has registered listeners.

    Returns (keyof NostrSystemEvents)[]

  • Return the number of listeners listening to a given event.

    Parameters

    • event: keyof NostrSystemEvents

    Returns number

  • Return the listeners registered for a given event.

    Type Parameters

    • T extends keyof NostrSystemEvents

    Parameters

    • event: T

    Returns ((...args) => void)[]

  • Type Parameters

    • T extends keyof NostrSystemEvents

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<NostrSystemEvents>[Extract<T, keyof NostrSystemEvents>]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Add a listener for a given event.

    Type Parameters

    • T extends keyof NostrSystemEvents

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<NostrSystemEvents>[Extract<T, keyof NostrSystemEvents>]

          Returns void

    • Optional context: any

    Returns this

  • Add a one-time listener for a given event.

    Type Parameters

    • T extends keyof NostrSystemEvents

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<NostrSystemEvents>[Extract<T, keyof NostrSystemEvents>]

          Returns void

    • Optional context: any

    Returns this

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: keyof NostrSystemEvents

    Returns this

  • Remove the listeners of a given event.

    Type Parameters

    • T extends keyof NostrSystemEvents

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<NostrSystemEvents>[Extract<T, keyof NostrSystemEvents>]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

Generated using TypeDoc