new Session(userName, webSocketUri, successCallback, failureCallback, sessionId, extHeaders)
Parameters:
Name | Type | Description |
---|---|---|
userName |
String | the 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 given ID; otherwise, the client will create a new Session. |
extHeaders |
JSON | extension headers. |
Members
-
ackInterval
-
the interval that client periodly sending acknowledgement message. The default value is 60000ms.
-
busyPingInterval
-
the ping interval at busy time. The default value is 3000ms. This ping interval is used when there are subSessions inside the Session.
-
idlePingInterval
-
the ping interval at idle time. The default value is 10000ms. This ping interval is used when there are no subSessions inside the Session. This value should not be greater than the WebRTC Session Controller server side value of "WebSocket Idle Time Limit".
-
reConnectInterval
-
the reConnect interval when a webSocket is abnormally closed. The default value is 2000ms.
-
reConnectTime
-
the reConnect time when a webSocket is abnormally closed. The default value is 60000ms. This value should not be greater than the WebRTC Session Controller server side value of "WebSocket Disconnect Time Limit".
-
retryCount
-
the timeout retry count. If this value is reached, the client will start the reconnect process. The default value is 2.
-
sessionId
-
the session id.
-
webSocketUri
-
the websocket uri.
Methods
-
close()
-
Closes the session and releases all the underlying resources.
Fires:
- wsc.Session.event:onSessionStateChange
-
getSessionId()
-
Gets the session ID.
-
getUserName()
-
Gets user name
-
setBusyPingInterval(pingInterval)
-
Sets the value of wsc.Session#busyPingInterval, the minimal value is 1000ms.
Parameters:
Name Type Description pingInterval
String the interval value in milliseconds
-
setIdlePingInterval(pingInterval)
-
Sets the value of wsc.Session#idlePingInterval, the minimal value is 1000ms.
Parameters:
Name Type Description pingInterval
String the interval value in milliseconds
-
setReconnectInterval(reconnectInterval)
-
Sets the value of wsc.Session#reConnectInterval
Parameters:
Name Type Description reconnectInterval
String the interval value in milliseconds
-
setReConnectTime(time)
-
Sets the value of wsc.Session#reConnectTime.
Parameters:
Name Type Description time
String the value in milliseconds
Events
-
failureCallback
-
the callback function for failed session creation.
-
onSessionStateChange
-
the callback function for session state changes.
Parameters:
Name Type Description sessionState
wsc.SESSIONSTATE the current session state.
-
successCallback
-
the callback function for a sucessfully created session.
Parameters:
Name Type Description extHeaders
JSON extension headers.