Options
All
  • Public
  • Public/Protected
  • All
Menu

This class sends membership changes for rooms in a linearized queue. The queue is lineaized based upon the hash value of the roomId, so that two operations for the same roomId may never happen concurrently.

Hierarchy

  • MembershipQueue

Index

Constructors

constructor

Methods

join

  • join(roomId: string, userId: string | undefined, req: ThinRequest, retry?: boolean, ttl?: undefined | number): Promise<void>
  • Join a user to a room

    Parameters

    • roomId: string

      The roomId to join

    • userId: string | undefined

      Leave empty to act as the bot user.

    • req: ThinRequest

      The request entry for logging context

    • Default value retry: boolean = true

      Should the request retry if it fails

    • Optional ttl: undefined | number

      How long should this request remain queued in milliseconds before it's discarded. Defaults to opts.defaultTtlMs

    Returns Promise<void>

    A promise that resolves when the membership has completed

leave

  • leave(roomId: string, userId: string, req: ThinRequest, retry?: boolean, reason?: undefined | string, kickUser?: undefined | string, ttl?: undefined | number): Promise<void>
  • Leave OR kick a user from a room

    Parameters

    • roomId: string

      The roomId to leave

    • userId: string

      Leave empty to act as the bot user.

    • req: ThinRequest

      The request entry for logging context

    • Default value retry: boolean = true

      Should the request retry if it fails

    • Optional reason: undefined | string

      Reason for leaving/kicking

    • Optional kickUser: undefined | string

      The user to be kicked. If left blank, this will be a leave.

    • Optional ttl: undefined | number

      How long should this request remain queued in milliseconds before it's discarded. Defaults to opts.defaultTtlMs

    Returns Promise<void>

    A promise that resolves when the membership has completed

queueMembership

  • queueMembership(item: QueueUserItem): Promise<void>

registerMetrics

  • registerMetrics(): void

Generated using TypeDoc