Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BackendSessionService

Service that maintains backend sessions and the communication with frontend servers.

BackendSessionService would be created in each server process and maintains backend sessions for current process and communicates with the relative frontend servers.

BackendSessionService instance could be accessed by app.get('backendSessionService') or app.backendSessionService.

class
constructor

Hierarchy

Implements

Index

Constructors

constructor

Properties

abind

abind: function = utils.promisify(this.bind)

Type declaration

    • (arg1: T1, arg2: T2, arg3: T3): Promise<TResult>
    • Parameters

      • arg1: T1
      • arg2: T2
      • arg3: T3

      Returns Promise<TResult>

aget

aget: function = utils.promisify(this.get)

Type declaration

    • (arg1: T1, arg2: T2): Promise<TResult>
    • Parameters

      • arg1: T1
      • arg2: T2

      Returns Promise<TResult>

agetByUid

agetByUid: function = utils.promisify(this.getByUid)

Type declaration

    • (arg1: T1, arg2: T2): Promise<TResult>
    • Parameters

      • arg1: T1
      • arg2: T2

      Returns Promise<TResult>

akickBySid

akickBySid: function = utils.promisify(this.kickBySid)

Type declaration

    • (arg1: T1, arg2: T2): Promise<TResult>
    • Parameters

      • arg1: T1
      • arg2: T2

      Returns Promise<TResult>

akickByUid

akickByUid: function = utils.promisify(this.kickByUid)

Type declaration

    • (arg1: T1, arg2: T2, arg3: T3): Promise<TResult>
    • Parameters

      • arg1: T1
      • arg2: T2
      • arg3: T3

      Returns Promise<TResult>

app

apush

apush: function = utils.promisify(this.push)

Type declaration

    • (arg1: T1, arg2: T2, arg3: T3, arg4: T4): Promise<TResult>
    • Parameters

      • arg1: T1
      • arg2: T2
      • arg3: T3
      • arg4: T4

      Returns Promise<TResult>

apushAll

apushAll: function = utils.promisify(this.pushAll)

Type declaration

    • (arg1: T1, arg2: T2, arg3: T3): Promise<TResult>
    • Parameters

      • arg1: T1
      • arg2: T2
      • arg3: T3

      Returns Promise<TResult>

aunbind

aunbind: function = utils.promisify(this.unbind)

Type declaration

    • (arg1: T1, arg2: T2, arg3: T3): Promise<TResult>
    • Parameters

      • arg1: T1
      • arg2: T2
      • arg3: T3

      Returns Promise<TResult>

name

name: string

Methods

bind

  • bind(frontendId: string, sid: number, uid: string, cb: function): void
  • Bind the session with the specified user id. It would finally invoke the the sessionService.bind in the cooperating frontend server.

    memberof

    BackendSessionService

    api

    private

    Parameters

    • frontendId: string

      cooperating frontend server id

    • sid: number

      session id

    • uid: string

      user id

    • cb: function

      callback function

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

          • err: Error | null
          • Optional result: void

          Returns void

    Returns void

create

get

  • get(frontendId: string, sid: number, cb: function): void
  • Get backend session by frontend server id and session id.

    memberof

    BackendSessionService

    Parameters

    • frontendId: string

      frontend server id that session attached

    • sid: number

      session id

    • cb: function

      callback function. args: cb(err, BackendSession)

    Returns void

getByUid

  • getByUid(frontendId: string, uid: string, cb: function): void
  • Get backend sessions by frontend server id and user id.

    memberof

    BackendSessionService

    Parameters

    • frontendId: string

      frontend server id that session attached

    • uid: string

      user id binded with the session

    • cb: function

      callback function. args: cb(err, BackendSessions)

    Returns void

kickBySid

  • kickBySid(frontendId: string, sid: number, cb: function): void
  • Kick a session by session id.

    memberof

    BackendSessionService

    Parameters

    • frontendId: string

      cooperating frontend server id

    • sid: number

      session id

    • cb: function

      callback function

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

          • err: Error | null
          • Optional result: void

          Returns void

    Returns void

kickByUid

  • kickByUid(frontendId: string, uid: string, reason: string, cb: function): void
  • Kick sessions by user id.

    memberof

    BackendSessionService

    Parameters

    • frontendId: string

      cooperating frontend server id

    • uid: string

      user id

    • reason: string

      kick reason

    • cb: function

      callback function

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

          • err: Error | null
          • Optional result: void

          Returns void

    Returns void

push

  • push(frontendId: string, sid: number, key: string, value: string, cb: function): void
  • Push the specified customized change to the frontend internal session.

    memberof

    BackendSessionService

    api

    private

    Parameters

    • frontendId: string

      cooperating frontend server id

    • sid: number

      session id

    • key: string

      key in session that should be push

    • value: string

      value in session, primitive js object

    • cb: function

      callback function

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

          • err: Error | null
          • Optional result: void

          Returns void

    Returns void

pushAll

  • pushAll(frontendId: string, sid: number, settings: Object, cb: function): void
  • Push all the customized changes to the frontend internal session.

    memberof

    BackendSessionService

    api

    private

    Parameters

    • frontendId: string

      cooperating frontend server id

    • sid: number

      session id

    • settings: Object

      key/values in session that should be push

    • cb: function

      callback function

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

          • err: Error | null
          • Optional result: void

          Returns void

    Returns void

unbind

  • unbind(frontendId: string, sid: number, uid: string, cb: function): void
  • Unbind the session with the specified user id. It would finally invoke the the sessionService.unbind in the cooperating frontend server.

    memberof

    BackendSessionService

    api

    private

    Parameters

    • frontendId: string

      cooperating frontend server id

    • sid: number

      session id

    • uid: string

      user id

    • cb: function

      callback function

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

          • err: Error | null
          • Optional result: void

          Returns void

    Returns void