UBSession

@unitybase/base/UBSession~ UBSession

new UBSession() protected

Internal class, returned as a result of UBConnection.authorize() The main method is UBSession.signature()

Developer never create this class directly.

Members

userData: Object protected readonly

Contain custom user data. Usually filled inside server onUserLogon event handlers

Do not use it directly, instead use helper method UBConnection.userData() instead.

authSchema: String protected readonly

Name of authentication schema

Methods

signature()string

Session signature for authorized request. Can be added as LAST parameter in url, or to Authorization header (preferred way)

 $App.connection.authorize().then(function(session){
     // for URL
     return 'session_signature=' + session.signature()
     //for header
     return {Authorization: session.authSchema + ' ' + session.signature()}
 });

isAnonymous()boolean

Current session is anonymous session

authHeader()string

Return authorization header

 $App.connection.authorize().then(function(session){
     return {Authorization: session.authHeader()}
 });

hexa8(value)String

Return hexadecimal string of 8 character length from value
Arguments:
  1. value (String|Number)

crc32(s, polynomialopt, initialValueopt, finalXORValueopt)Number

Calculate CRC32 checksum for string
Arguments:
  1. s (String)  string to calculate CRC32
  2. [polynomial] (Number)  polynomial basis. default to 0x04C11DB7
  3. [initialValue] (Number)  initial crc value. default to 0xFFFFFFFF
  4. [finalXORValue] (Number)  default to 0xFFFFFFFF