Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Channel

Channel maintains the receiver collection for a subject. You can add users into a channel and then broadcast message to them by channel.

class

channel

constructor

Hierarchy

  • Channel

Index

Constructors

constructor

Properties

___channelService__

___channelService__: ChannelService

apushMessage

apushMessage: function = utils.promisify(this.pushMessage)

Type declaration

    • (route: string, msg: any, opts?: any): Promise<void>
    • Parameters

      • route: string
      • msg: any
      • Optional opts: any

      Returns Promise<void>

groups

groups: object

Type declaration

  • [sid: string]: string[]

name

name: string

records

records: object

Type declaration

  • [key: string]: object
    • sid: string
    • uid: string

state

state: number

userAmount

userAmount: number

Methods

add

  • add(uid: string, sid: string): boolean

destroy

  • destroy(): void

getMember

  • getMember(uid: UID): object

getMembers

  • getMembers(): string[]

getUserAmount

  • getUserAmount(): number

leave

pushMessage

  • pushMessage(route: string, msg: any, opts?: any, cb?: function): void
  • Push message to all the members in the channel

    Parameters

    • route: string

      message route

    • msg: any

      message that would be sent to client

    • Optional opts: any

      user-defined push options, optional

    • Optional cb: function

      callback function

        • (err: Error | null, result?: void): void
        • Parameters

          • err: Error | null
          • Optional result: void

          Returns void

    Returns void