IrisRtcConnection

IrisRtcConnection

new IrisRtcConnection()

Constructor for IrisRtcConnection
This class maintains APIs required for creating and maintaining connection with rtc server.

Methods

close()

API to disconnet from the rtc server connection

connect(irisToken, routingId, eventManagerUrl)

This method is called to create a connection with websocket server. It takes routingId of the user and iris token as parameters, this method makes a call to event manager's API /v1/wsturnserverinfo/routingid/:routingid to get websocket_server, websocket_server_token, websocket_server_token_expiry_time and turn_credentials details.

Establishes a web socket connection with the rtc server for the user with routingId.

Parameters:
Name Type Description
irisToken string

Authorisation token or iris token is obtained from Auth manager by providing media token and authentication type

routingId string

Unique participant Id of user. It is obtained from application server

eventManagerUrl string

Event Manager url to make iris connection

isConnectionAlive() → {boolean}

To check if connection is alive or not

Returns:

True if connection is alive

Type
boolean

onConnected()

Called when websocket is connection is established

onConnectionError(errorCode, errorMessage)

This callback is called if there are any errors while creating connection

Parameters:
Name Type Description
errorCode integer

Error code

errorMessage string

Error message

onDisconnected()

Callback for websocket disconnection

onEvent()

Called when connection has an event

onNotification(notificationInfo)

This callback is called when an incoming call notification is received and notifies client about the incoming call and passes notification information received

Parameters:
Name Type Description
notificationInfo json

Notification payload received from the remote participant

Properties
Name Type Description
type string

It can be "notify" or "cancel"

roomId string

Room id to be joined

routingId string

Routing Id of the user calling

roomtoken string

Room token

roomtokenexpirytime string

Room token expiry time

traceId string

Trace id for the call

userdata string

user related data

Properties
Name Type Description
data string

User data like cname

Properties
Name Type Description
cname string

cname set by the caller

cid string

Id of the caller

notification string

Notification related topic or srcTN

Properties
Name Type Description
srcTN string

Telephone number of caller

topic string

Notification topic

onReconnecting()

Callled when Iris Connection is disconnected and SDK is trying to reconnect.

rejectSession(notificationPayload)

This API is called to Reject an incoming call

Parameters:
Name Type Description
notificationPayload json

Notification payload having roomid, roomtoken, roomtokenexpirytime, rtcserver and traceid

updateToken()

If a token is expired when connections is alive, token is to be updated using this API In case connection closes because of any network issues, SDK will try to re-connect in that scenario if we have pre-emptively have an updated token re-connection will faster otherwise SDK will fail to reconnect.