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: undefined | string, req: ThinRequest, retry?: boolean, ttl?: number): Promise<void>
  • Join a user to a room

    Parameters

    • roomId: string

      The roomId to join

    • userId: undefined | string

      Leave empty to act as the bot user.

    • req: ThinRequest

      The request entry for logging context

    • retry: boolean = true

      Should the request retry if it fails

    • Optional ttl: 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?: string, kickUser?: string, ttl?: 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

    • retry: boolean = true

      Should the request retry if it fails

    • Optional reason: string

      Reason for leaving/kicking

    • Optional kickUser: string

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

    • Optional ttl: 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