Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ChannelService

Create and maintain channels for server local.

ChannelService is created by channel component which is a default loaded component of pinus and channel service would be accessed by app.get('channelService').

class
constructor

Hierarchy

Implements

Index

Constructors

constructor

Properties

abroadcast

abroadcast: function = utils.promisify(this.broadcast)

Type declaration

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

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

      Returns Promise<void>

app

apushMessageByUids

apushMessageByUids: function = utils.promisify(this.pushMessageByUids)

Type declaration

    • (route: string, msg: any, uids: object[], opts?: Object): Promise<void>
    • Parameters

      • route: string
      • msg: any
      • uids: object[]
      • Optional opts: Object

      Returns Promise<void>

broadcastFilter

broadcastFilter: any

channelRemote

channelRemote: ChannelRemote

channels

channels: object

Type declaration

name

name: string

prefix

prefix: string

store

store: IStore

Methods

broadcast

  • broadcast(stype: string, route: string, msg: any, cb?: function): void
  • Broadcast message to all the connected clients.

    memberof

    ChannelService

    Parameters

    • stype: string

      frontend server type string

    • route: string

      route string

    • msg: any

      message

    • Optional cb: function

      callback

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

          • Optional err: Error
          • Optional result: void

          Returns void

    Returns void

createChannel

  • createChannel(name: string): Channel

destroyChannel

  • destroyChannel(name: string): void

getChannel

  • getChannel(name: string, create?: boolean): Channel

pushMessageByUids

  • pushMessageByUids(route: string, msg: any, uids: object[], cb?: function): void
  • Push message by uids. Group the uids by group. ignore any uid if sid not specified.

    memberof

    ChannelService

    Parameters

    • route: string

      message route

    • msg: any

      message that would be sent to client

    • uids: object[]

      the receiver info list, [{uid: userId, sid: frontendServerId}]

    • Optional cb: function

      cb(err)

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

          • Optional err: Error
          • Optional result: void

          Returns void

    Returns void

start

  • start(cb: function): void