IRIS Rtc Embedded SDK - A node js version of IRIS SDK
iris-embedded-sdk is a node js version of IRIS SDK targeted towards headless or native embedded implementations/products. It installs as a service on the embedded linux or linux enviornment and the APIs are accessible through a [REST interface]
API support
This SDK exposes local API interface and can be run locally as a service
Installation
npm i iris-embedded-sdk
How to Use
Initializing
IRIS Rtc Embedded SDK initializes with the default config during service startup.
RtcConfig.js - the default config
RtcConfig.json={
urls:{
appServer: <>, // Iris App server
authManager: <>, // Iris Auth Manager
idManager: <>, // Iris Identity manager
eventManager: <>, // Iris Event Manager
notificationManager: '', // Iris Notification Manager
},
port: <>, // Default port where service starts listening
pingInterval: <>, // ping interval to keep web socket alive
presInterval: <>, // presenceIQ interval
reconnectInterval: <>, // reconnection interval
statsInterval: <>, // stats to post interval
useAnonymousLogin: <>, // Set to use anonymous login
useAutoAnswer: <>, // Set to auto answer
useBridge: <>, // Set to use video bridge
useEmPrivateIQ: <>, // Set to use private IQ.
logLevel: <>, // 0: Error, 1: Warning, 2: Info, 3: Verbose
webrtcLogs: <>, // Set to enable detailed libjingle logs
loadCount: <>, // load testing count
appKey: <>, // Set here Iris app key
appSecret: <>, // Set here Iris app secret
authMgrPath: <>, // Iris auth manager url
audioForSessions: <>, // to enable/disable audio
sdkVersion: <>, // sdk version
}
Starting Service
Run this command to start embededded SDK service:
$ node IrisRtcSdk.js
Creating Connection
Register API allows to handle the public id entered by application This public id will be exchanged with IRIS backend and a token will be obtained and makes the connection with IRIS backend.
curl -v -X PUT -H "Content-Type: application/json" -d '{"uniqueId":"1234","type":"macid","domain":"service.example.net"}' http://localhost:8091/v1/rtc/register
Create Session
Create Session API allows to initiate outgoing calls using embedded SDK
curl -v -X PUT -H "Content-Type: application/json" -d '{"type":"video","roomname":"testroom"}' http://localhost:8091/v1/rtc/createSession
Join Session
Join Session API allows to join and incoming call using embedded SDK
curl -v -X PUT -H "Content-Type: application/json" -d '{"type":"audio", "roomid":"***", "roomtoken":"***","roomtokenexpirytime":"****", rtcserver:"***", traceid:"***"}' http://localhost:8091/v1/rtc/joinSession
End Session
End Session API allows to end the current sessions using embedded SDK
curl -v -X PUT -H "Content-Type: application/json" -d '{"type":"video","sessionId":"11321201"}' http://localhost:8091/v1/rtc/endSession
Get Events
Events API allows to send events using embedded SDK
var EventSource = require('eventsource');
var es = new EventSource('http://localhost:8091/v1/rtc/events');
es.onmessage = function(e) {
var data = JSON.parse(e.data);
console.log(data);
};