SDK Initialization
Initialize SDK configuration
Update the basic user configuration with IrisRtcConfig.updateConfig
API. Mandatory config parameters required are :
var sdkConfig = {
"urls": {
"eventManager": "<EVM_URL>",
},
"useAnonymousLogin": "<True or false>",
"logLevel": "< 1 to 3 >",
"reconnectInterval": "<Time interval in milliseconds>"
}
IrisRtcConfig.updateConfig(sdkConfig);
Establish RTC connection
A successful RTC (websocket) connection is required for a user to initiate a create new session or join a session on invite from other user, this RTC connection is used to manage the connection with 555 backend. It also involves making the necessary REST API calls with event manager and other components to get the resources required for the connection.
Instantiate IrisRtcConnection
class as
var Connection = new IrisRtcConnection();
Call connect
API to with JWT token, routing id of the user and event manager url.
Parameters | |
---|---|
token | json web token for event manager REST call |
routingId | User's routing Id from Identity manager. |
evmUrl | Event Manager URL to get the RTC server info |
Connection.connect(token, routingId, evmUrl);
Disconnect from RTC Connection
To disconnect from RtcConnection, use
Connection.close();
Callbacks for RTC Connection
onConnected
This callback is called when the connection is established/successful.
Connection.onConnected = () => {
// Connection is done
};
onDisconnected
This callback is called when the connection is disconnected.
Connection.onDisconnected = () => {
// Connection is closed
};
onConnectionError
This callback is called when there is an error.
Connection.onConnectionError = (errorCode, errorMessage) => {
// Error in connecting
};
Parameters | |
---|---|
errorCode | Error Code |
errorMessage | Error description |
onNotification
This callback is called when notification is received for this RTC connection instance.
Connection.onNotification = (notificationInfo) => {
// An invite to join a session is received
};
Parameters | |
---|---|
notificationInfo | Notification payload |