Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Message

Index

Variables

TYPE_NOTIFY

TYPE_NOTIFY: number = 1

TYPE_PUSH

TYPE_PUSH: number = 3

TYPE_REQUEST

TYPE_REQUEST: number = 0

TYPE_RESPONSE

TYPE_RESPONSE: number = 2

Functions

decode

  • decode(buffer: Buffer): object
  • Message protocol decode.

    Parameters

    • buffer: Buffer

      message bytes

    Returns object

    message object

    • body: any
    • compressGzip: number
    • compressRoute: number
    • id: number
    • route: string | number
    • type: number

encode

  • encode(id: number, type: number, compressRoute: boolean, route: number | string | Buffer, msg: Buffer, compressGzip?: boolean): any
  • Message protocol encode.

    Parameters

    • id: number

      message id

    • type: number

      message type

    • compressRoute: boolean

      whether compress route

    • route: number | string | Buffer

      route code or route string

    • msg: Buffer

      message body bytes

    • Optional compressGzip: boolean

    Returns any

    encode result