npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iris-react-sdk

v2.0.2

Published

React version of 555 RTC JS SDK

Downloads

18

Readme

react-js-sdk

npm version

This document covers the 555 JavaScript SDK's React Component.

Getting started

$ npm install iris-react-sdk --save

Usage - Examples

import {RoomContainer, RtcSdk} from 'iris-react-sdk';
  1. Make connection using iristoken and routingId

    
    // Call connection method
    RtcSdk.connect(iristoken, routingId, config.urls.eventManager);
    
    //Listen to onConnected event
    RtcSdk.onConnected = () => {
      console.log("App :: onConnected :: Iris connection successful");
    }
    
    //Listen to notification event
    RtcSdk.onNotification = (payload) => {
      console.log("App:: onNotification :: Payload : ", JSON.stringify(payload));
    }
    
    //Listen to iris diconnected event
    RtcSdk.onDisconnected = () => {
      console.log("App:: onDisconnected");
    }
    
    
    //Listen to connection errors
    RtcSdk.onError = (error) => {
      console.log("App:: onError :: error : ", error);
    }
    
  2. Using RoomContainer to initiate/accept call


return (
  <RoomContainer
  ref="room"
  Type={this.state.Type}
  RoomId={this.state.RoomId}
  Config={this.state.Config}
  NotificationPayload={this.state.NotificationPayload}
  onLocalStream={this.onLocalStream}
  onRemoteStream={this.onRemoteStream}
  onSessionCreated={this.onSessionCreated}
  onSessionJoined={this.onSessionJoined}
  onSessionConnected={this.onSessionConnected}
  onSessionParticipantJoined={this.onSessionParticipantJoined}
  onSessionParticipantAudioMuted={this.onSessionParticipantAudioMuted}  
  onSessionParticipantLeft={this.onSessionParticipantLeft}
  onSessionEnd={this.onSessionEnd}
  onUserProfileChange={this.onUserProfileChange}
  onSessionSIPStatus={this.onSessionSIPStatus}
  onError={this.onError}
  onEvent={this.onEvent}
  />
)

...

let roomId = response.room_id;
let Config = {
  irisToken: "",
  routingId: "",
  toTN: "",
  fromTN: "",
  toRoutingId: "",
  traceId: "",
  userData: "",
  SessionType: 'outgoing',
  notificationPayload: ''
};
this.setState({
  RoomId:roomId,
  Config:Config,
});

APIs

Connection APIs - Make a connection using connect

  • Example
import RtcSdk from 'iris-react-sdk';
RtcSdk.connect(irisToken, routingId, serverUrl);
  • Params

    • serverUrl {String}: The url to event manager
    • irisToken {String}: A valid IRIS token
    • routingId {String}: Routing id of the user who is trying to login

Connection APIs - Disconnect using disconnect

  • Example
import RtcSdk from 'iris-react-sdk';
RtcSdk.disconnect();
  • Params

    • None

Media devices - Get a list of meida devices with getMediaDevices

Returns a promise with list of available audio and video devies

  • Example
import RtcSdk from 'iris-react-sdk';
RtcSdk.getMediaDevices();

Request Media Device Permission - requestMediaPermission

Returns a promise with boolean whether permission is acquired or not

  • Example
import RtcSdk from 'iris-react-sdk';
let deviceType = 'microphone'
RtcSdk.requestMediaPermission(deviceType).then((permissionAcquired){
  if(permissionAcquired){
    // Success
  }else{
    // Failed
  }
});

PSTN APIs - Hold a PSTN call using pstnHold

  • Example
this.refs.room.pstnHold(roomId, participantJid);
  • Params

    • roomId {String} : Room Id
    • participantJid {String}: Remote participant routingId/resourceId

PSTN APIs - UnHold a PSTN call using pstnUnHold

  • Example
this.refs.room.pstnUnHold(roomId, participantJid);
  • Params

    • roomId {String} : Room Id
    • participantJid {String}: Remote participant routingId/resourceId

PSTN APIs - Merge two PSTN calls using pstnMerge

  • Example
this.refs.room.pstnMerge(roomId, firstParticipantJid, secondParticipantJid);
  • Params

    • roomId {String} : Room Id
    • firstParticipantJid {String}: First remote participant's routingId/resourceId
    • secondSession {object}: IrisRtcSession object of the session to be merged
    • secondParticipantJid {String}: Second remote participant's routingId/resourceId

PSTN APIs - End PSTN call using pstnHangup

  • Example
this.refs.room.pstnHangup(roomId, participantJid);
  • Params

    • roomId {String} : Room Id
    • participantJid {String}: Remote participant's routingId/resourceId

Callbacks

Connection - For connection successful listen to onConnected

  • Example
RtcSdk.onConnected = () => {
  console.log("App :: onConnected :: Iris connection successful");
}
  • Params

    • None

Connection - For Notification listen to onNotification

  • Example
RtcSdk.onNotification = (notificationPayload) => {
  console.log("App :: notificationPayload :: Iris notification received");
}
  • Params

    • notificationPayload {json} : Notification payload with the information to join session

Session - For PSTN SIP Status listen to onSessionSIPStatus

  • Example
  onSessionSIPStatus = (roomId, participantJid, status) => {
  console.log("App :: onSessionSIPStatus :: PSTN SIP Status : "+ status);
}
  • Params

    • roomId {String} : RoomId of the session
    • participantJid {String} : Jid of the participant
    • status {String} : PSTN Status ex. initializing, connecting, ringing, connected.

RoomContainer - For local media stream onLocalStream

  • Example
onLocalStream = (stream) => {
  console.log("App :: onLocalStream :: Local media stream received");
}
  • Params

    • stream {object} : Local media stream