Client for managing and subscribing to Donation Alerts events.

This class provides a WebSocket-based interface for real-time interaction with the Donation Alerts platform. It connects to its Centrifugo WebSocket server, enabling receiving notifications about donations, goal updates, and poll updates.

Designed for single-user use cases, it supports managing connection states (connect, disconnect, reconnect) and subscribing to or unsubscribing from specific event types.

Hierarchy

  • EventEmitter
    • UserEventsClient

Constructors

Properties

onConnect: EventBinder<any[]> = ...

Fires when the client establishes a connection with Centrifugo server.

onDisconnect: EventBinder<[reason: string, reconnect: boolean]> = ...

Fires when the client disconnects from the Centrifugo server.

Accessors

Methods

  • Type Parameters

    • Args extends any[]

    Parameters

    • event: EventBinder<Args>
    • listener: EventHandler<Args>

    Returns Listener

  • Establishes a connection to the Centrifugo server.

    Parameters

    • restoreExistingListeners: boolean = true

      Specifies whether existing listeners should be restored after connection. Defaults to true.

    Returns Promise<void>

  • Closes the connection to the Centrifugo server.

    Parameters

    • removeListeners: boolean = false

      Indicates whether all active listeners should be removed on disconnect. If set to false, the listeners will be restored on the next connection. Default to false.

    Returns Promise<void>

  • Type Parameters

    • Args extends any[]

    Parameters

    • event: EventBinder<Args>
    • listener: EventHandler<Args>

    Returns Listener

  • Re-establishes the connection to the Centrifugo server.

    Parameters

    • removeListeners: boolean = false

      Indicates whether all listeners should be removed during reconnection. If false, all listeners will be restored automatically after reconnection. Defaults to false.

    Returns Promise<void>

  • Type Parameters

    • Args extends any[]

    Returns EventBinder<Args>

  • Parameters

    • id: Listener

    Returns void

  • Type Parameters

    • Args extends any[]

    Parameters

    • Optionalevent: EventBinder<Args>
    • Optionallistener: EventHandler<Args>

    Returns void