new ExtensibleSession(useName, webSocketUri, successCallback, failureCallback, sessionId, extHeaders, extPayloads, stateInfo)
Parameters:
Name | Type | Description |
---|---|---|
useName |
String | the current user name. |
webSocketUri |
String | the WebSocket server URI. |
successCallback |
the success callback function. |
|
failureCallback |
the failure callback function. |
|
sessionId |
String | If an application provides the sessionId, the client will try to rehydrate the Session with the that id; otherwise, the client will create a new Session. |
extHeaders |
JSON | extension headers. |
extPayloads |
JSON | extension payload for push notification service. |
stateInfo |
JSON | Session data for rehydration. |
Methods
-
getAllSubSessions() → {Array}
-
Gets all sub-sessions managed by this session.
Returns:
An array of sub-session objects
- Type
- Array
-
getPackage(packageType)
-
Gets the specified package from the session.
Parameters:
Name Type Description packageType
String the type of the package
Returns:
the package with the specified name, or null if not found.
-
getSubSession(id)
-
Gets sub-session by sub-session id.
Parameters:
Name Type Description id
String the sub-session id
Returns:
sub-session with the given id.
-
getSubSessionsByPackageType(packageType) → {Map}
-
Gets all sub-sessions that belong to the specified package.
Parameters:
Name Type Description packageType
String the package type.
Returns:
Map that contains all sub-sessions. The key is sub-session ID and the value is the sub-session.
- Type
- Map
-
putSubSession(packageType, id, subSession)
-
Puts a sub-session object into the session.
Parameters:
Name Type Description packageType
String the package type.
id
String the sub-session id.
subSession
a sub-session object.
-
registerPackage(package)
-
When implementing a package, a public property named packageType is required, and is used as a the key in the session.
Parameters:
Name Type Description package
the package that needs to register with the session.
-
removeSubSession(id)
-
Removes sub-session object by id.
Parameters:
Name Type Description id
String the sub-session id
-
saveToStorage()
-
Saves the session data to html5 client sessionStorage.
-
sendMessage(message)
-
Sends the message to WebRTC Session Controller server. The sequence number of this session is updated according to the parameter impactSeqNum.
Parameters:
Name Type Description message
wsc.Message the wsc.Message object which denotes the message data to send to WebRTC Session Controller server
-
setSessionState(sessionState)
-
Set the session's current state.
Parameters:
Name Type Description sessionState
String the new session state.
Fires:
- wsc.Session.event:onSessionStateChange