Class: Session

wsc. Session

Represents a session between the client and the WebRTC Session Controller server. A client application is expected to create only one session towards the WebRTC Session Controller server for each user. A session may have one or more sub-sessions.

A wsc.AuthHandler object should be created to get "SERVICE", "TURN" or other authentication information. When a wsc.AuthHandler is created using "new wsc.AuthHandler(session)", it registers with the session implicitly.
When receiving an incoming message from WebRTC Session Controller, the session dispatches the message to the appropriate package handler like, wsc.CallPackage or wsc.MessagelertPackage in order to the message.

The package handlers can create a sub-session to process the message if needed. For example, the wsc.CallPackage creates a wsc.Call to process call related messages. This wsc.Call is a sub-session. All the messages that belong to a call share the same sub-session ID.

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.

Oracle® Communications WebRTC Session Controller JavaScript API Reference, E55131-03
Copyright © 2013, 2015, Oracle and/or its affiliates. All rights reserved.