Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Hierarchy

  • ActivityTracker

Index

Constructors

Accessors

Methods

Constructors

constructor

Accessors

usingWhois

  • get usingWhois(): null | boolean

Methods

isUserOnline

  • isUserOnline(userId: string, maxTimeMs: number, defaultOnline?: boolean): Promise<{ inactiveMs: number; online: boolean }>
  • 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 }>

setLastActiveTime

  • setLastActiveTime(userId: string, ts?: number): void
  • 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