Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BackendSession

BackendSession is the proxy for the frontend internal session passed to handlers and it helps to keep the key/value pairs for the server locally. Internal session locates in frontend server and should not be accessed directly.

The mainly operation on backend session should be read and any changes happen in backend session is local and would be discarded in next request. You have to push the changes to the frontend manually if necessary. Any push would overwrite the last push of the same key silently and the changes would be saw in next request. And you have to make sure the transaction outside if you would push the session concurrently in different processes.

See the api below for more details.

class
constructor

Hierarchy

  • BackendSession

Index

Constructors

constructor

Properties

___sessionService__

___sessionService__: BackendSessionService

abind

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

Type declaration

    • (arg1: T1): Promise<TResult>
    • Parameters

      • arg1: T1

      Returns Promise<TResult>

apush

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

Type declaration

    • (arg1: T1): Promise<TResult>
    • Parameters

      • arg1: T1

      Returns Promise<TResult>

apushAll

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

Type declaration

    • (): Promise<TResult>
    • Returns Promise<TResult>

aunbind

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

Type declaration

    • (arg1: T1): Promise<TResult>
    • Parameters

      • arg1: T1

      Returns Promise<TResult>

frontendId

frontendId: string

id

id: number

settings

settings: any

uid

uid: string

Methods

bind

  • bind(uid: string, cb: function): void
  • Bind current session with the user id. It would push the uid to frontend server and bind uid to the frontend internal session.

    memberof

    BackendSession

    Parameters

    • 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

export

  • export(): any

get

  • get(key: string): any

push

  • push(key: string, cb: function): void
  • Push the key/value in backend session to the front internal session.

    Parameters

    • key: string

      key

    • cb: function

      callback function

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

          • err: Error | null
          • Optional result: void

          Returns void

    Returns void

pushAll

  • pushAll(cb: function): void
  • Push all the key/values in backend session to the frontend internal session.

    Parameters

    • cb: function

      callback function

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

          • err: Error | null
          • Optional result: void

          Returns void

    Returns void

set

  • set(key: string, value: any): void

unbind

  • unbind(uid: string, cb: function): void
  • Unbind current session with the user id. It would push the uid to frontend server and unbind uid from the frontend internal session.

    memberof

    BackendSession

    Parameters

    • 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