Hierarchy

  • EventEmitter<{
        cancel: [id: string, sub: NostrSub, reason: string];
        close: NostrSocket;
        connected: NostrSocket;
        error: Error;
        event: EventMessage;
        notice: string;
        ready: NostrSocket;
        receipt: ReceiptEnvelope;
        reject: [reason: string, event: string];
        subscribe: [id: string, sub: NostrSub];
    }>
    • NostrSocket

Constructors

  • Parameters

    Returns NostrSocket

Properties

_address: null | string
_buffer?: Timeout
_events: Map<"cancel" | "connected" | "close" | "error" | "event" | "notice" | "ready" | "reject" | "receipt" | "subscribe", Set<Function>>
_init: boolean
_outbox: SignedEvent[]
_socket: null | WebSocket
_subs: Map<string, NostrSub>
log: {
    debug: ((...s) => null | void);
    info: ((...s) => null | void);
} = ...

Type declaration

  • debug: ((...s) => null | void)
      • (...s): null | void
      • Parameters

        • Rest ...s: unknown[]

        Returns null | void

  • info: ((...s) => null | void)
      • (...s): null | void
      • Parameters

        • Rest ...s: unknown[]

        Returns null | void

Accessors

Methods

  • Parameters

    • reason: string
    • event: string

    Returns void

  • Parameters

    • payload: string[]

    Returns void

  • Parameters

    • payload: string[]

    Returns void

  • Parameters

    • payload: string[]

    Returns Promise<void>

  • Parameters

    • event: string

    Returns Set<Function>

  • Parameters

    • msg: any

    Returns void | Promise<void>

  • Parameters

    • payload: string[]

    Returns void

  • Parameters

    • event: string

    Returns void

  • Type Parameters

    • K extends "cancel" | "connected" | "close" | "error" | "event" | "notice" | "ready" | "reject" | "receipt" | "subscribe"

    Parameters

    Returns void

  • Type Parameters

    • K extends "cancel" | "connected" | "close" | "error" | "event" | "notice" | "ready" | "reject" | "receipt" | "subscribe"

    Parameters

    • topic: K

    Returns boolean

  • Type Parameters

    • K extends "cancel" | "connected" | "close" | "error" | "event" | "notice" | "ready" | "reject" | "receipt" | "subscribe"

    Parameters

    • event: K
    • method: ((args) => void | Promise<void>)
        • (args): void | Promise<void>
        • Parameters

          Returns void | Promise<void>

    Returns void

  • Type Parameters

    • K extends "cancel" | "connected" | "close" | "error" | "event" | "notice" | "ready" | "reject" | "receipt" | "subscribe"

    Parameters

    • event: K
    • method: ((args) => void | Promise<void>)
        • (args): void | Promise<void>
        • Parameters

          Returns void | Promise<void>

    Returns void

  • Type Parameters

    • K extends "cancel" | "connected" | "close" | "error" | "event" | "notice" | "ready" | "reject" | "receipt" | "subscribe"

    Parameters

    • event: string
    • method: ((args) => void | Promise<void>)
        • (args): void | Promise<void>
        • Parameters

          Returns void | Promise<void>

    Returns void

  • Parameters

    • event: UnsignedEvent
    • signer: ((msg) => string | Promise<string>)
        • (msg): string | Promise<string>
        • Parameters

          • msg: string

          Returns string | Promise<string>

    Returns Promise<unknown>

  • Parameters

    • event: UnsignedEvent
    • signer: ((msg) => string | Promise<string>)
        • (msg): string | Promise<string>
        • Parameters

          • msg: string

          Returns string | Promise<string>

    Returns Promise<{
        content: string;
        created_at: number;
        id: string;
        kind: number;
        pubkey: string;
        sig: string;
        tags: string[][];
    }>

  • Parameters

    • sub_id: string

    Returns Promise<unknown>

  • Parameters

    • event_id: string

    Returns Promise<unknown>

  • Parameters

    • sub_id: string

    Returns Promise<unknown>

  • Type Parameters

    • K extends "cancel" | "connected" | "close" | "error" | "event" | "notice" | "ready" | "reject" | "receipt" | "subscribe"

    Parameters

    • event: K
    • method: ((args) => void | Promise<void>)
        • (args): void | Promise<void>
        • Parameters

          Returns void | Promise<void>

    • timeout: number

    Returns void

Generated using TypeDoc