This class provides a "one stop shop" to determine if a user is online. It uses a combination of a local cache, presence endpoints and admin APIs in that order.

Constructors

Accessors

Methods

  • Determine if a user is online or offline using a range of metrics.

    Parameters

    • userId: string

      The userId to check

    • maxTimeMs: number

      The maximum time a user may be inactive for before they are considered offline.

    • Optional defaultOnline: boolean

      Should the user be online or offline if no data is found. Defaults to opts.defaultOnline

    Returns Promise<{
        inactiveMs: number;
        online: boolean;
    }>

  • Sets the last active time of the user to ts. By default this is the current time.

    Parameters

    • userId: string

      The userId of a user who performed an action.

    • ts: number = ...

      The timestamp to set in milliseconds.

    Returns void

Generated using TypeDoc