Getting Started


Install the library from NPM

npm install react-native-hdmeet or yarn add react-native-hdmeet

initial configuration

Add the package react-native-webrtc in your project since it is a dependency package for the SDK

npm install react-native-webrtc or yarn add react-native-webrtc

Add this line of code in android/gradle.properties in order to avoid WebRTC runtime problem on some devices

(android.enableDexingArtifactTransform.desugaring = false)

Meeting session

Create a meeting session in your client application.

import { MeetingSession } from "react-native-hdmeet";

After installing the package react-native-hdmeet you have to create an object of a class MeetingSession to use the available methods in SDK.

const meetingsession = new MeetingSession(
apiKey,
logLevel,
environmentLevel
);

apikey - It is a unique identifier to authorize your client with Hoolva server. You will get the api key from developer portal.

logLevel - Specifies log level to be shown from the SDK. Available values are -

valuesDescription
1Shows all logs including warnings, errors, info and logs
2Shows logs including warnings, errors and info
3Shows logs including warnings and errors
4Shows error logs only
5No logs from SDK, logs will be turned off

environmentLevel - specifies which servers should hdmeet connects to. Available environmentLevels are sandbox and production

environmentLevel - specifies which servers should hdmeet connects to. Available environmentLevels are sandbox and production

After creating an object of “MeetingSession” it can be used to call the methods available in the SDK. Some functions triggers Eventlistners which are provided by the SDK. In order to get these events it needs to be added before calling any SDK methods.

Eventlistners are used to capture asynchronous events occurred in SDK. Eventlistners consist of a key and a callback.

Meetingsession.addEventListener(key, callback)

Available Eventlisteners are documented under Meeting events

Note - To avoid unexpected behavior of the SDK it is recommended to call the eventlistener before the calling the SDK methods.

Sample use case

To authenticate a meeting we can use preAuth inside the Meetingsession

Meetingsession.preAuth(username, password)

All available functions are documented in Meeting methods

Binding the streams

When a stream is available, an eventlistener with the key streamReceived is invoked in client side (assuming its already added. Example below,

Returned data is an object which has type stream and participant_id . type - specifies which stream is received. available types for streamReceived data are audio, video and screenshare stream - contains the stream. participant_id - specifies which participant’s stream is received

event listener can be added like below-

meetingsession.addEventListener("streamReceived", (data) => {
// actions needed to be done after receiving the stream
})

The stream can be used in StreamView component which can be imported from react-native-hdmeet to render video/audio/screenshare stream

import { StreamView } from 'react-native-hdmeet'

streams can be added into StreamView like this:-

<StreamView stream={stream} />
NameTypeDefaultDescription
mirrorbooleanfalseIndicates whether the video specified by "streamURL" should be mirrored during rendering. Commonly applications choose to mirror the user-facing camera
objectFitstring'contain'Can be contain or cover
streamURSTRING"This is mandatory
zOrdernumber0Similarly to zindex

WARNING : react-native-hdmeet doesn’t work on Chrome debugger mode due to the usage of sync methods in react-native-webrtc. To know more about troubleshooting please read How to debug your react-native application

Meeting Events

The HDMeet SDK sends meeting lifecycle events, which you can use to trigger notifications and initiate downstream workflows. Some examples of using meeting events include:

Updating metadata when a participant joins or leaves HDMeet SDK meeting. Implementing push notifications or rosters for HDMeet SDK meetings. Measuring the usage of video and content sharing in HDMeet SDK meetings

Room State

roomstate - When a participant tries to join a meeting they won’t redirect to the session immediately. The meeting might be closed or requires permission from the host to join the meeting. The person trying to join the meeting should be aware of the meeting room state so they navigate to the appropriate page ( waiting room ). roomstate event fires when they try to join a meeting after calling startMeetingSession and returning the current meeting room state data.

state: meetingsession.addEventListener('roomState', function (state) {
// Do the actions you want to do on this event
if (state === 'open') {
// user can directly navigate to the meeting.
}
if (state === 'close') {
// The meeting is locked. participant should wait for the host to allow them to the meeting
}
if (state === 'deny') {
// host has denied your entry.
}
})

meetingsession is the object of the class MeetingSession which is imported from hdmeet. For more information Getting Started

Possible returned data are open, close and deny

  1. open - room is open and any participants can join before host approves.

  2. close - room is closed and any guest participants will be in waiting room and automatically join when host joins the meeting or allows the participant.

  3. deny- Host has denied your access to the meeting. deny event can only be received after a close event.

Join Meeting

joinMeeting – After calling startMeetingSession SDK will create the necessary connections to start a meeting. This event is fired when these connections have been successfully created and the participant is ready to join the meeting.

meetingsession.addEventListener('joinMeeting', (state) => {
// the participant is ready to join on meeting
})

We should also consider the room state before navigating to the meeting.

Participant List

participantList – When a new participant joins, the participant details are shared with other participants via participantList event. The data of local participant is also shared through this event.

meetingsession.addEventListener("participantList", (data) => {
// details of the participant
})

Returned data is an object consisting of participant details.

Types of returned data as follows :

{
name: string
participant_id: string
audio: boolean
video: boolean
videoStream: MediaStream | null
screenshareStream: MediaStream | null
mixedAudio: MediaStream | null
isPublisher: boolean
host: boolean
speaking: boolean
raiseHand: boolean
screenshare: boolean
}
  • name :- name of the participant
  • participant_id:- a unique identifier for a particular participant
  • audio:- indicates current audio status of the participant
  • Video :- indicates current video status of the participant
  • isPublisher:- indicates if the participant is local or remote. true for local participant and false for remote participant
  • host :- indicates if the participant is host for the meeting
  • Speaking:- indicates if participant is talking right now
  • raiseHand :- indicates if the participant is raise handing or not
  • Screenshare :- indicates if the screenshare status of the participant
  • videoStream:- contains a video stream of the participant.
  • mixedAudio :- contains audio track of the meeting
  • screenshareStream : contains a screen share stream of the participant

When videoStream, mixedAudio and screenshareStream are updated, it is passed through streamReceived event .This is only available for react native since binding streams requires streams instead of participant_id (Stream Bind), other updates are updated via updateparticipantlist.

Stream Modified

Event is fired after calling remoteParticipantVideoQuality and pauseSubscriberVideo functions. It returns current remote participant video quality or pause status of participants.

meetingsession.addEventListener('streammodified', (data) => {
//contains pause status or video quality of participants when it changes
})

Remote participant video quality event contains data type as follows :

{
title: "videoQuality",
participants: Array<string>,
bitrate: 0 | 1 | 2,
framerate: 0 | 1 | 2
}
  • title:- will be videoQuality for remote participant video quality event.
  • Participants:- An array of participant_id who’s video quality has been updated. This updation of video quality will only affect for local participant.
  • Bitrate:- value ranges from 0 to 2. 2 is high and 0 is low.
  • framerate:- value ranges from 0 to 2. 2 is high and 0 is low.

Pause status of participants event contains data type as follows :

{
title: "pause",
participants: Array<string>,
Pause: boolean
}
  • title:- will be pause for the pause event.
  • Participants:- An array of participant_id who’s pause status has been updated. This updation of pause status will only affect for local participant.
  • Pause:- indicates pause status of the returned participant. Values will be true or false.
    true indicates that participants are being paused.
    false indicates participants Video is resumed.
    Pause is only available for video for now.

Stream Received

streamReceived – When a stream is received and ready for binding, streamReceived is received through the event listener. When this event is received stream can be used in StreamView to view the stream.

meetingsession.addEventListener('streamReceived', (data) => {
// contains which type of stream is received and the corresponding participant_id
})

The returned data type contains partcipant_id of the participant with stream. type indicates which stream is received. possible data are :

{
state: boolean,
participant_id: string,
type: ”audio”| “video” | “screenshare”,
stream: MediaStream
}

Network State

networkState - Event is received when a network instability occurs in a meeting.

meetingsession.addEventListener('networkState', (data) => {
// returns data with title and reason
})

Returned data consist of title and reason/state

Title may contain :

  • Connection_failed :- When the necessary connections got teared down . This can occur due to a network issue. SDK will automatically reconnect back to the meeting.
  • network_rejoin:- event fires when SDK is attempting to rejoin. network_rejoin has two types of reasons. attempting to rejoin indicates the reconnection is in progress and rejoined successfully indicates that reconnection has been successfully completed.
  • Latency:- indicates how much latency of the network. Possible states are low, medium and high.
  • pakcet_drop:- indicates how much packet drop experienced by the participant. Possible state are low, medium and high.
  • badNetwork:- indicates low reception of network.
  • no_network:- network is not available.
  • Back_online:- network is available after a no_network event.

Network Stream Lost

networkStreamLost – event is received when a network stream is lost

{
"stream": video,
"value": 54
}

People Waiting

peopleWaiting – When a meeting is in a close state, participants cannot join the meeting without the permission of the host. At this time participants will be in the waiting room. peopleWaiting informs participants in the waiting room. This event is only received for the host.

meetingsession.addEventListener('peopleWaiting', (data) => {
// fires when participant is on waiting room
})

peopleWaiting contains data as follows :

{
state: boolean
name: string
transaction_id: Array<string>
}

transaction_id contains a unique identifier for the waiting list which will be different at each time. This transactionid can be passed to _hostAllowParticipants to allow that particular participant. The host can allow this participant.

Remove From Waiting List

removeFromWaitingList – When the host allows or rejects participants, the removeFromWaitingList event is fired with the transaction_id of participants. This event is also received when other host allow or reject participants.

meetingsession.addEventListener('removeFromWaitingList', (data) => {
// contains an object with field transactions which conatins array of transaction_id
})

The participants returned from this listener need to be removed from the waiting room list since they are no longer in the waiting room. A unique identifier returned from the transactions is the key to identify the participants in the waiting room.

Meeting State

A meeting can be opened or closed. Anyone can join an open meeting. But to join a closed meeting, one should wait for the host or need to be accepted by the host. The state of the room will be received through a meetingstate listener. Event is fired while joining a meeting or the meeting state is changed while on meeting by the hosts.

meetingsession.addEventListener('meetingstate', (data) => {
// contains lock room status
})

Returned data is on this format.

{
type: ”lock_room”,
state: boolean
}

State indicates whether the meeting is closed or open.


true indicates that room is closed and


false indicates that room is open.



Participants should not wait for this event to navigate to the waiting room. roomstate is used for that purpose. meetingstate is used to show the current status of a meeting and it can be used to show the current meeting status inside the meeting. One can change the meeting state using hostLockMeetingAction.

Pause Video

pauseVideo – event is received as response to pauseSubscriberVideo.

{
participants:['d61ce814-3916-4554-b068-80b29b898609']
pause: true
}

Update Participant List

updateparticipantlist– event is received when the participant list changes, ie video, audio is turned on/off. particpant is speaking or not etc.

{
participant_id:"81667683-945d-4427-ab23-93e5c5fe491c"
state: false
type: "video"
}

Chat

chat - When another participant sends a message it receives through the chat listener. Both private and public (Group) messages are received through this event.

meetingsession.addEventListener('chat', (data) => {
// errors occurred by the issues from user side//data.isgroup
if (data.isgroup) {
// group messages
} else {
//private messages
}
})

Returned data contains :-

{
status: “delivered” | ”pending”
seen: boolean
isgroup: boolean
type: “text”|”file”
participant_id: string
message: string
title: “text”
sender: string
timestamp: number;
participant_name: string;
}
  • seen:- it indicates whether a local participant has read this message. Right now, there is no way to know when a remote participant has read the message

  • isgroup:- indicates if the message is a group or private. For the group message, it will be true.

  • type:- it indicates if a message is a file or text. If it is a file, the message will be a link to that file.

  • sender:- contains the participant_id of the sender

  • participant_id:- contains the participantid of the receiver. If it is a group, the whole participant will receive the message. So the data will be "allparticipant" in this event

  • message:- message contains the chat / file send by the participants

  • title:- will always be “text” (will be removed on refactoring)

  • timestamp:- contains the timestamp when the message is sent

  • participant_name:- contains the name of the participant who sent the message

  • status:- will be “delivered” or “pending”. “pending” indicates that a message has been sent to a remote participant and it’s not reached yet there. “delivered” indicates that a message is delivered to the local participant and it’s not seen yet. Only the messages sent by local participants contain the status as “pending”. When it’s been delivered, we just need to update the status. The returned data to update local participant message is as follows :

{
status: “delivered”
isgroup: boolean;
participant_id: string;
timestamp: number;
}

Host

host - There are some features the host can perform in the meeting :

  • mute/unmute audio or video of other participants.
  • Kicks out a participants from a meeting
  • Ends the meeting for all participants
  • Raise down the raise-hand participants

host event fires when the host performs any of these actions.

meetingsession.addEventListener('host', (data) => {
if (data.title === 'hostEndForAll') {
// received when host ends the meeting for all
} else if (data.title === 'hostKickOut') {
// received when host kicks you out
} else if (data.title === 'hostMuteUnmute') {
if (data.stream === 'audio') {
// received when host mutes your mic
} else if (data.title === 'video') {
// received when host mutes your camera
}
} else if (data.title === 'down_hand_by_host') {
// received when host downs your raise hand
}
})

One can perform actions based on the host's request using this listener. Returned data is as follows :

  • hostEndForAll:-
{
title: 'hostEndForAll'
state: boolean
}

When an event is received SDK forcefully ends the meeting. Since user is no longer in the meeting they needs to be navigated out of the meeting page.

  • hostMuteUnmute:-
{
title: "hostMuteUnmute",
mute:boolean,
participant_id: string,
publisher_id: string,
stream: "audio" | “video”
}

When the host mutes/unmutes your video/audio hostMuteUnmute event is received. When the host mutes your audio or video SDK forcefully mutes the participant. While the host requests to unmute, SDK won’t update the mute status. Instead, it only passes down the event so the participant can decide whether he/she should turn on the video/audio.

  • hostKickOut:-
{
title: "hostKickOut",
state:boolean,
participant_id: string,
}

Event is received when the host kicks you out of the meeting. The participant is no longer in the meeting and can be navigated outside the meeting. Participant_id indicates the participant_id of the host who kicked you out.

  • Down_hand_by_host:-

When the host removes your raise hand you will receive the event. SDK removes the raise hand forcefully and local participant should remove it front their list.

{
title: "down_hand_by_host",
state:boolean,
participant_id: string,
}

Participant_id indicates the participant_id of the host who down handed you out.

Device List Modified

deviceListModified – event is fired on certain circumstances.

  • When there’s a change on device is detected ( when a device is connected or removed)
  • After calling listAvailableDevices to fetch device list
  • After switching audio/video devices with switchDevices.
meetingsession.addEventListener('deviceListModified', (data) => {
if (data.title === 'device_modified') {
// call listAvailableDevices to fetch the device which updates device list
}
if (data.title === 'currentdevice') {
// current device in use has been updated. update the device list accordingly
}
})

deviceListModified returns data with title device_modified when a new audio/video device is added or removed. So the device list on the client side needs to be updated accordingly. Currentdevice returns currently used audio/video device. The event is fired when calling listAvailableDevices for initial device state and switchDevices to inform currently used devices.

currentdevice returns audio video I/O device id which will be of string type. currentdevice with reason initial_state returns currently used I/O devices while reason with update_state only returns device id, which has been changed. Other I/O which remains same will contain value of unchanged in update_state.

Sample returned data of deviceListModified with title currentdevice and reason initial_state as follows:-

{
title: "currentdevice",
reason: "initial_state",
currentDevice: {
audioInput: "0ef1ef67f4a04bb910fe6527892d7339a23a8bdfaf650956f56306546f1ca69b"
audioOutput: "136caf6a27fcdc960cfe70b55a765993bb72298070ddfdd356c19ec851ce50d2"
videoInput: "d5996c4305fdd7e80f5011215f235bb436e1014f6dcd66990ee33445cab5b3ac"
}
}

Sample returned data of deviceListModified with title currentdevice and reason update_state as follows:-

{
title: "currentdevice",
reason: "update_state",
currentDevice: {
audioInput: "0ef1ef67f4a04bb910fe6527892d7339a23a8bdfaf650956f56306546f1ca69b"
audioOutput: "unchanged"
videoInput: "unchanged"
}
}

deviceListModified should be added before calling listAvailableDevices and switchDevices to avoid missing the event. But it is advised to add this listener right after creating MeetingSession.

Left Participant

leavedParticipant – When a participant leaves the meeting leftparticipant event is fired to acknowledge other participants. Event is fired when a participant leaves a meeting, leftparticipant occurs for both self participant and remote participant. leftparticipant occurs on numerous occasion :

  • When a remote participant leaves the meeting
  • When self participant ends the meeting
  • When the host kicks out the self participant
  • When the host ends the meeting
  • On websocket close event (need to describe it other section)
{
meetingsession.addEventListener('leftparticipant', (data) => {
// if it’s a remote participant remove the participant from the list
})
}

leftparticipant returns data with participant_id and name of the participant who left the meeting. Returned data will be the same for both local and remote participants.

Error Handler

errorhandler - Meetings can be interrupted or may not work due to some reasons. SDK passes information about this issue so clients can behave accordingly. It is important to acknowledge users about this issue which can be resolved on their part.

meetingsession.addEventListener('errorhandler', (data) => {
// errors occurred by the issues from user side
})

data with title websocket_closed indicates that the meeting can no longer be continued from the user side since the connections are already closed for various reasons. data with the title device_error indicates an error occurred while creating a stream using mediadevices.

Meeting Methods

User Login

The userLogin function is used to log a user into the application. Once logged in, the user is able to start a new meeting with a new meeting id, schedule a meeting, and perform other actions. This function allows users to authenticate and access the features and functionality of the SDK.

meetingsession.userLogin(userName,password)
.then((res)=>{
// contains device list information
})
.catch((e)=>{// handle error})

userLogin type is as follows:

userLogin(
userName: string,
password: string
)
.then((res)=>{
//login success
})
.catch((e)=>{// login failed})

userName - userName is a string parameter.

password - password is a string parameter representing the user's password.

After login success response contains:

{
email: string
firstname: string
lastname: string
token: string
hoolva_user: string
}

email - email is a property that holds a string value, which can be any sequence of characters, representing the email of a user.

firstname - firstname is a property that holds a string value, which can be any sequence of characters, representing the first name of a user.

lastname - lastname is a property that holds a string value, which can be any sequence of characters, representing the last name of a user.

token - token is a property that holds a string value, which could be an authentication token that could be used to identify a user.

hoolva_user - hoolva_user is a property that holds a string value. This is to identify the user in hoolva.

The AddApiHeader function can be used to retain the login session after the browser tab is reopened. To do this, the hoolva_user token should be passed to the token field in the AddApiHeader function. This will allow the login session to be preserved and eliminate the need to log in again using credentials. In order to pass the hoolva_user token, it must be stored in the database. This function allows users to maintain their login session across different browser sessions and improve the user experience.

User Logout

To log out one needs to call the userLogout function. This will terminate the login session.

meetingsession.userLogout().then((res) => {
//log out successfully
})

After a successful log out the function will return:

status: "success";
message: "Logged out successfully";
}

status - status is a property that holds a string value, It could represent the status of the operation indicating a successful logout.

message - message is a property that holds a string value, It could hold a message that provides more information about the status of the operation, such as providing feedback that the logout was successful.

Add Api Header

AddApiHeader can be used to retain login session or add headers to the api calls.

meetingsession.AddApiHeader({ token, optional })

token - Optional field used to retain a login session. type is string

optional - Optional field used to add headers to the api. Types as follows:

Array<{header:string , value:string}>

header - key of the header in api.

value - value of the header in api.

Api header can be added as follows:

meetingsession.AddApiHeader({
optional: [
{
header: 'sample',
value: 'value',
},
],
})

optional - optional is a parameter that holds an array of objects, each object contains two properties.

header - header is a parameter that holds a string value, which represents the name of the header.

value - value is a parameter that holds a string value, which represents the value of the header.

Claim Login Session

claimLoginSession ( token : string ) : void

You can use this to resume your login session if the token is available. This helps you to avoid using userLogin every time.

Parameters

  • token : string Returns void

Forgot Password

forgotPassword ( email : string ) : any

Resets the password by sending a resend link to the registered email address.

Parameters

  • email : string

Returns any

Add Event Listener

On SDK numerous events are occurring at a time. Meetings on the client side should be event driven. Events need to be handled on client side for a proper working of the meeting. Events can be listened using the addEventListener function. Eventlistener can be used as follows:

meetingsession.addEventListener(key, callback)

Listeners should be added right after creating MeetingSession. When an event occurs concurrent callback function is called Meeting events

Possible keys for listeners are :

  • deviceListModified

  • leftparticipant

  • joinMeeting

  • host

  • networkState

  • participantList

  • streammodified

  • peopleWaiting

  • chat

  • removeFromWaitingList

  • roomState

  • streamReceived

  • updateparticipantlist

  • meetingstate

  • errorhandler

Pre Auth

When a user needs to join a meeting he/she must authenticate before starting a meeting. Authentication can be done using passing meeting id and password to preAuth. user can also authenticate using sname.

Joining the meeting with meetingId and password

meetingsession.preAuth({meetingId:6382448382,password:”dJbsU5”})
.then((res)=>{
// contains response
})
.catch()

For authenticating a meeting it’s necessary to pass sname or meetingId to preauth. For authenticating to the meeting which doesn’t have a password, one just needs to pass only the meetingId. Inorder to find if a meeting needs a password pass the meetingId first. If the meeting has a password it will return an error code 401. In that case we need to re authenticate with meetingId and password.

meetingId - meetingId is a parameter that expect a number value, which represents the ID of a meeting.

password - the password is a parameter that expect a string value, which represents the password to join the meeting.

Joining the meeting with sname

meetingsession.preAuth({sname:”cHskOl”})
.then((res)=>{
// contains response
})
.catch((e)=>{
// handle error
})

sname is a unique string which we receive in meeting url parameter in meeting invite function. When you call meeting invite function you will get a meeting url as response along with other data. When you parse the meeting url you will get a rtdf value which is atob encoded. When you decode this rtdf value you will the sname. The decoded value is stringified value which need to json parsed. While joining the meeting using sname, we just need to pass the sname only, meetingid and password is not required.

Response will be same if you join with meeting id and password or with sname.

{
audio_bridge: boolean;
auto_record: boolean;
dial_in: boolean;
dial_out: boolean;
duration: number;
host: boolean;
join_mode: “open” | “close” | “lock”;
meetingId: number;
name: string;
description: null | string;
password: string;
}

audio_bridge - audio_bridge is a property that holds a boolean value, which can be either true or false. it could represent if the audio bridge is enabled or not. returns true when audio bridge is enabled.

auto _record - auto_record is a property that holds a boolean value, which can be either true or false. it could represent if automatic recording is enabled or not. returns true when automatic recording of the meeting is enabled.

duration - duration is a property that holds a number value, which could represent the duration of the meeting. duration is represented in seconds.

meetingId - meetingId is a property that holds a number value, which could represent the id of the meeting.

name - name is a property that holds a string value, which could represent the name of the meeting. This field is often used to represent the meeting topic.

description - is a property that holds a string value or null, which could represent the meeting description or agenda if there is any.

dial_in- dial_in is a property that holds a boolean value, which can be either true or false. it could represent if dial-in is enabled or not. Returns true if the dial in is enabled.

dial_out - dial_in is a property that holds a boolean value, which can be either true or false. it could represent if dial-out is enabled or not. Returns true if dial out is enabled.

host - host is a property that holds a boolean value, which can be either true or false. it could represent if the user is the host of the meeting or not. Returns true if the current user is the host of this meeting.

join_mode - join_mode is a property that holds a string value; it can hold one of the three string literals- ”open”, “close” or “lock”. If join mode is open it represents an open meeting which means guest users are allowed to join the meeting at any time. If join mode is close, guest users are not allowed to join the meeting they have to wait till host join the meeting. If join mode is lock, guest users have to wait till host join the meeting and unlock the meeting. These modes are default state of the meeting while meeting is scheduled. These values are subject to change when host join the meeting and change meeting join mode to lock. In that case, when a user join the meeting he should always listen to the roomState to find out the actual join mode.

password - password is a property that holds a string value, which could represent the password to join the meeting.

Scheduled Meeting Create

scheduledMeetingCreate method is used to schedule the meeting with desired configurations. This method is only available for the authorized users. If parameters are not specified, the scheduledMeetingCreate function will still create a meeting with default configurations. The data types for the parameters of the scheduledMeetingCreate function are as follows:

scheduledMeetingCreate(meetingData?:{
name: string,
description: string,
auto_record: boolean,
dial_in: boolean,
join_mode: string,
password: string,
pin: number | null,
duration: number,
record_mode: string,
recurrence: boolean,
recurrence_repeat: number | null,
recurrence_day: number | null,
recurrence_type: number | null,
recurrence_weekdays: Array<unknown>,
recurrence_date: number | null,
start_date_time: number,
time_zone: string,
})

name - name of the meeting. If not added default value will be "Discussion".

description - Description or agenda of the meeting.

auto_record - represents whether the meeting should be automatically recorded or not. Default value will be false.

dial_in - represents whether the participants can join the meeting via dial-in or not. Default value will be true.

join_mode - indicates the default state of the meeting. Possible values are “open” and “locked”. Default value will be “locked”.

password - password of the meeting. If not passed a random password will be generated.

pin - indicates the pin of the meeting. If not passed a random pin will be generated.

duration - indicates duration of the meeting in seconds.

record_mode - property that holds a string value, which represents the recording mode of the meeting. Available recording modes are “audio_only”,“host_only”, “host_with_others”. Please refer cloud recording for more information.

recurrence - indicates if a meeting should have multiple occurrence. default value will be false.

recurrence_repeat - property that holds a number or null, which represents the number of times the meeting will repeat.

recurrence_day - property that holds a number or null, which represents the day of the week of the recurring meeting.

recurrence_type - property that holds a number or null, which represents the type of recurrence.

recurrence_weekdays - property that holds an array of unknown, which represents the weekdays of the recurrence.

recurrence_date - property that holds a number or null, which represents the date of the recurrence.

start_date_time - indicates the start time of the meeting. It is indicating the valid time of the Meeting.which represents the start date and time of the meeting.

time_zone - time_zone of the person who is creating the meeting. If not given, SDK will select user’s time zone by default.

An example scheduleMeetingCreate can be as follows:

meetingsession.scheduledMeetingCreate({
name: “Discussion”,
description: “”,
auto_record: false,
dial_in: false,
join_mode: “locked”,
password: “QbI5BV”,
pin: 272584,
duration: 3600,
record_mode: "host_with_others",
recurrence: false,
recurrence_repeat: null,
recurrence_day: null,
recurrence_type: null,
recurrence_weekdays: null,
recurrence_date: null,
start_date_time: 16723789,
time_zone: "Asia/Kolkata",
})
.then((res)=>{
//response
})

Create Instant Meeting

createInstantMeeting method is to create a new meeting and join to it immediately. This is a convenient way to start a meeting quickly, as it creates a new meeting with default settings. This method is only available for the authorized users.

meetingsession.createInstantMeeting({
name: “Discussion”,
password: “QbI5BV”,
recurrence: false,
join_mode: “locked”,
time_zone: "Asia/Kolkata",
pin: 272584,
dial_in: true,
auto_record: false,
start_date_time: 16723789,
e2ee: false
})
.then((res)=>{
//response
})

If no parameters are specified, the function will create a meeting with default settings. This is a convenient way to start a meeting immediately.

Data type of createInstantMeeting is as follows:

createInstantMeeting(meetingData?:{
name?: string,
password?: string,
recurrence?: boolean,
join_mode?: string,
time_zone?: string,
pin?: number,
dial_in?: boolean,
auto_record?: boolean,
start_date_time?: number,
})

Default parameters of createInstantMeeting are as follows:

name - the name of the meeting, with a default value of "Discussion" if not specified.

password - password for the meeting, which will be randomly generated if not provided.

recurrence - indicating whether the meeting should take place on multiple days, with a default value of false.

join_mode - the default state of the meeting, with possible values of "open" or "locked", and a default value of "locked".

time_zone - the time zone of the person creating the meeting, which will be collected by the SDK if not provided.

pin - a pin for the meeting, which will be randomly generated if not provided.

dial_in - indicating whether the meeting can be joined by phone, with a default value of true.

auto_record - indicating whether the meeting will be recorded automatically, with a default value of false. The default record mode will be host_only in this case.

start_date_time - the start date and time of the meeting.

Start Meeting Session

The startMeetingSession function is used to start a new meeting after a successful authentication using preAuth. To start the meeting, the startMeetingSession function should be called and passed the name, audio, and video choices and the state of the meeting.

meetingsession.startMeetingSession(audio, video, DisplayName)

startMeetingSession will not work without authentication.

startMeetingSession((audio: boolean), (video: boolean), (DisplayName: string))

audio - specifies whether the client should join the meeting with audio enabled.

video - specifies whether the client should join the meeting with video enabled.

DisplayName - indicates the display name of the participant.

After the startMeetingSession function is called, the roomState event is fired to indicate the state of the room. This event allows the client to track and update the status of the meeting.

Switch Camera

switchCamera can be used to switch between the front and back camera of the device.

meetingsession.switchCamera()

Meeting List

The meetingList function can be used to retrieve a list of meetings that a user can join. By providing the date and time, meetings which are scheduled during that period will be retrived. Optionally, you can just give the start date and time to retrieve all the meeting scheduled from that time till the current date and time. This method is only available for the authorized users.

meetingsession.meetingList(start_date_time, end_date_time)
.then((res)=>{
//details of the meeting with meeting_id which is passed to this
function
})

start_date_time - scheduled meetings will be returned from that time onwards.

end_date_time - (optional parameter) Only the meetings between start_date_time and end_date_time will be returned.

meetingList((start_date_time: number), (end_date_time: number))

Returned data is as follows:

Array<{
name: string,
description: string,
auto_record: boolean,
dial_in: boolean,
join_mode: string,
password: string,
pin: number | null,
duration: number,
record_mode: string,
recurrence: boolean,
recurrence_repeat: number | null,
recurrence_day: number | null,
recurrence_type: number | null,
recurrence_weekdays: Array<unknown>,
recurrence_date: number | null,
start_date_time: number,
time_zone: string,
}>

name - the name of the meeting, with a default value of "Discussion".

description - a description of the meeting.

auto_record - a boolean value indicating whether the meeting should be automatically recorded, with a default value of false.

dial_in - a boolean value indicating whether dial-in options should be enabled for the meeting, with a default value of true.

join_mode - a string indicating the default state of the meeting when participants join. Possible values are "open" and "locked", with a default value of "locked".

password - a string representing the password required to join the meeting. If not provided, a random password will be generated.

pin - a string representing the PIN required to join the meeting. If not provided, a random PIN will be generated.

duration - the duration of the meeting in minutes.

record_mode - property that holds a string value, which represents the recording mode of the meeting.

recurrence - a boolean value indicating whether the meeting should recur on multiple days, with a default value of false.

recurrence_repeat - property that holds a number or null, which represents the number of times the meeting will repeat.

recurrence_day - property that holds a number or null, which represents the day of the week of the recurring meeting.

recurrence_type - property that holds a number or null, which represents the type of recurrence.

recurrence_weekdays - property that holds an array of unknown, which represents the weekdays of the recurrence.

recurrence_date - property that holds a number or null, which represents the date of the recurrence.

start_date_time - the start time of the meeting in ISO-8601 format. This specifies the time at which the meeting is valid.

time_zone - the time zone of the person scheduling the meeting. If not provided, the time zone will be determined by the SDK.

Meeting Invite

The meetingInvite function is used to get a meeting url that can be shared with other participants to invite them to a meeting. To use this function, you need to pass in the UUID of the desired meeting. The resulting launchMeetingUrl can then be shared with other participants to allow them to join the meeting.

meetingsession.meetingInvite(meeting_uuid).then((res) => {
//response contains data which include meeting invite link
})

meeting_uuid - a unique id in string which represent the meeting.

returned data contains data as follows:

{
tenant: string
pin: number | null
password: string
meeting_url: string
meeting_topic: string
host: string
meeting_id: 1234567890
did_info: unknown
date_time: unknown
}

tenant - the tenant name or organization name associated with the meeting.

pin - the pin number for the meeting.

password - the password for the meeting (if one is set).

meeting_url - a meeting url that can be used to join the meeting.

meeting_topic - a description of the meeting.

host - the host of the meeting.

meeting_id - the unique identifier for the meeting.

Delete Meeting

Scheduled meeting can be deleted using deleteMeeting function. This method is only available for the authorized users.

meetingsession.deleteMeeting(meeting_uuid).then((res) => {
//meeting has successfully deleted
})

meeting_uuid - a unique identifier which used to identify the meeting.

Mute Stream Action

The muteStreamAction function is used to mute or unmute the audio and video of a local participant while in a meeting. This function allows the local participant to control their audio and video during the meeting. It is important to note that the muteStreamAction function can only be called inside a meeting.

meetingsession.muteStreamAction(participant_id, stream, muteState)

muteStreamAction type is as follows:

muteStreamAction(
participant_id: string,
stream: ”camera” | “mic”,
muteState: boolean,
)

participant_id - specifies the participant_id of the local participant.

stream - indicates which device, camera for video and mic for audio.

mutestate - specifies the mute status of the stream. true indicates that the stream should be muted, and false indicates that it should be unmuted.

It is important to note that the mute status on the participant list should not be updated immediately after calling the muteStreamAction function. Instead, the updateParticipantList event should be waited for to update the mute status. This event is fired after the muteStreamAction function is called to update the local participant list. This function allows the local participant to control their audio and video during the meeting.

Content Share Action

contentShareAction ( audio : boolean, video : boolean ) : void

You can start a screen share using this function.You can pass audio and video as true to start the screenshare. To stop an on going screenshare you can pass false to audio and video.You cannot start contentShare with passing only audio as true and video as false but you can pass video as true and audio as false.

Parameters

  • audio : boolean,
  • video : boolean

Returns void

Update Schedule Meeting

Scheduled meetings can be updated via UpdateScheduleMeeting. This method is only available for the authorized users.

meetingsession.updateScheduleMeeting({
name: “Discussion”,
description: “”,
auto_record: false,
dial_in: false,
join_mode: “locked”,
password: “QbI5BV”,
pin: 272584,
duration: 3600,
record_mode: "host_with_others",
recurrence: false,
recurrence_repeat: null,
recurrence_day: null,
recurrence_type: null,
recurrence_weekdays: null,
recurrence_date: null,
start_date_time: 16723789,
time_zone: "Asia/Kolkata",
})
.then((res)=>{
//meeting has successfully updated
})

When updating a meeting using the UpdateScheduleMeeting function, you only need to provide the updated fields. You do not need to pass all of the data for the meeting again. The data types for the parameters of the UpdateScheduleMeeting function are as follows:

UpdateScheduleMeeting(meetingData?:{
name: string,
description: string,
auto_record: boolean,
dial_in: boolean,
join_mode: string,
password: string,
pin: number | null,
duration: number,
record_mode: string,
recurrence: boolean,
recurrence_repeat: number | null,
recurrence_day: number | null,
recurrence_type: number | null,
recurrence_weekdays: Array<unknown>,
recurrence_date: number | null,
start_date_time: number,
time_zone: string,
})

name - name of the meeting. If not added default value will be "Discussion".

description - Description of the meeting.

auto_record - represents whether the meeting should be automatically recorded or not. Default value will be false.

dial_in - which represents whether the participants can join the meeting via dial-in or not. Default value will be true.

join_mode - indicates the default state of the meeting. Possible values are “open” and “locked”. Default value will be “locked”.

password - password of the meeting. If not passed it will be randomly generated.

pin - indicates the pin of the meeting. If not passed it will be randomly generated.

duration - indicates duration of the meeting in minutes.

record_mode - property that holds a string value, which represents the recording mode of the meeting.

recurrence - indicates if a meeting should take place on multiple days. default value will be false.

recurrence_repeat - property that holds a number or null, which represents the number of times the meeting will repeat.

recurrence_day - property that holds a number or null, which represents the day of the week of the recurring meeting.

recurrence_type - property that holds a number or null, which represents the type of recurrence.

recurrence_weekdays - property that holds an array of unknown, which represents the weekdays of the recurrence.

recurrence_date - property that holds a number or null, which represents the date of the recurrence.

start_date_time - indicates the start time of the meeting. It is indicating the valid time of the Meeting.which represents the start date and time of the meeting.

time_zone - time_zone of the person who is creating the meeting. If not passed it will be collected by the SDK.

Get Schedule Meeting

To retrieve details about a specific meeting, you can use the getScheduleMeeting function and provide the meeting_id as an input. This method is only available for the authorized users.

meetingsession.getScheduleMeeting(meeting_id)
.then((res)=>{
//details of the meeting with meeting_id which is passed to this
function
})

meeting_id - the unique identifier for the meeting.

The returned data includes the following information:

{
name: string,
description: string,
auto_record: boolean,
dial_in: boolean,
join_mode: string,
password: string,
pin: number | null,
duration: number,
record_mode: string,
recurrence: boolean,
recurrence_repeat: number | null,
recurrence_day: number | null,
recurrence_type: number | null,
recurrence_weekdays: Array<unknown>,
recurrence_date: number | null,
start_date_time: number,
time_zone: string,
}

name - name of the meeting. If not added default value will be "Discussion".

description - Description of the meeting.

auto_record - represents whether the meeting should be automatically recorded or not. Default value will be false.

dial_in - which represents whether the participants can join the meeting via dial-in or not. Default value will be true.

join_mode - indicates the default state of the meeting. Possible values are “open” and “locked”. Default value will be “locked”.

password - password of the meeting. If not passed it will be randomly generated.

pin - indicates the pin of the meeting. If not passed it will be randomly generated.

duration - indicates duration of the meeting in minutes.

record_mode - property that holds a string value, which represents the recording mode of the meeting.

recurrence - indicates if a meeting should take place on multiple days. default value will be false.

recurrence_repeat - property that holds a number or null, which represents the number of times the meeting will repeat.

recurrence_day - property that holds a number or null, which represents the day of the week of the recurring meeting.

recurrence_type - property that holds a number or null, which represents the type of recurrence.

recurrence_weekdays - property that holds an array of unknown, which represents the weekdays of the recurrence.

recurrence_date - property that holds a number or null, which represents the date of the recurrence.

start_date_time - indicates the start time of the meeting. It is indicating the valid time of the Meeting.which represents the start date and time of the meeting.

time_zone - time_zone of the person who is creating the meeting. If not passed it will be collected by the SDK.

Raise Hand Action

A participant can raise their hand on the meeting to contribute a point or ask a question.

meetingsession.raiseHandAction(state)

state- a boolean field which indicates a participant should raise hand or down the hand.

updateparticipantlist event is fired after the raiseHandAction to update the local participant list.

Raise Hand Action

A participant can raise their hand on the meeting to contribute a point or ask a question.

meetingsession.raiseHandAction(state)

state- a boolean field which indicates a participant should raise hand or down the hand.

updateparticipantlist event is fired after the raiseHandAction to update the local participant list.

Send Message

Local participants can use sendMessage to send texts or files to other participants.

meetingsession.sendMessage(message, type, participant_id)

Data type of sendMessage is as follows:

message: string | Blob,
type: “text” | ”file”,
participant_id: string,
)

message - indicates the message that needs to be sent to another participant.

type - specifies whether the message is a text or a file.

participant_id - an optional field that specifies which participant the message should be sent to. If the message is for all the participants in the meeting, there is no need to specify the participant_id.

After the sendMessage function is called, a chat event is fired to update or add the message to the chat list.

List Available Devices

listAvailableDevices ( ) : Promise<ListDeviceType>

Shows a list of available input and output devices to choose from

Returns Promise<ListDeviceType>

Switch Devices

switchDevices ( deviceId : string, device : string, bindId ? : string ) : void

Allows participants to change their input or output devices to a new one.

Parameters

  • deviceId : string,
  • device : string,
  • optional bindId : string

Returns void

Stream Bind

streamBind ( stream : string, participant_id : string, tile_id : string ) : void

Binds participant’s Audio/video/screenshare to an element. Use this only after elements has been created.

Parameters

  • stream : string,
  • participant_id : string,
  • tile_id : string

Returns void

Stream Unbind

streamUnbind ( tile_id : string ) : void

Unbinds streams from an element. Use this only after elements has been created.

Parameters

  • tile_id : string

Returns void

Pause Subscriber Video

pauseSubscriberVideo method can be used to pause the video of a remote participant. This function is useful to save the bandwidth, the video of a remote participant can be paused when the remote user is not the current view.

meetingsession.pauseSubscriberVideo(participantsId, pause)

Data type of pauseSubscriberVideo is as follows:

pauseSubscriberVideo((participantsId: Array<string>), (pause: boolean))

participantsId - an array of participants whose video should be paused or resumed.

pause - a boolean value that indicates whether the video should be paused (true) or resumed (false).

After calling the pauseSubscriberVideo function, a streammodified event is fired to notify about the update. Note that the local participant's video cannot be paused using this function.

Remote Participant Video Quality

The remoteParticipantVideoQuality function can be used to adjust the video quality of a remote participant. This is very useful to save the bandwidth. We can request for low quality video when the video tile size is small, eg, while a screenshare or whiteboard session is in progress.

meetingsession.remoteParticipantVideoQuality(participantsId, bitrate, framerate)

Data type of remoteParticipantVideoQuality is as follows:

remoteParticipantVideoQuality(
(participantsId: Array<string>),
(bitrate: 0 | 1 | 2),
(framerate: 0 | 1 | 2)
)

participantsId - an array of participants whose video quality should be adjusted. Note that the local participant's video quality cannot be changed using this function.

bitrate - a value that indicates the desired video bitrate, with 2 representing high bitrate and 0 representing low bitrate.

Framerate - a value that indicates the desired video frame rate, with 2 representing high frame rate and 0 representing low frame rate. The highest frame rate is 30 fps.

It is recommended to use bitrate and framerate with same value when requesting a remote video quality, eg, if bitrate is 1 keep 1 for framerate also.

After calling the remoteParticipantVideoQuality function, a streammodified event is fired to notify about the update.

Host Allow Participants

When a participant is in the waiting room, the host gets a peopleWaiting event listener which contains transactionid. The transaction id can be passed to _hostAllowPartcipant to allow or deny the access to the meeting.

meetingsession.hostAllowParticipants(transaction_id, allow)

Data type of hostAllowPartcipant is as follows:

hostAllowParticipants(
transaction_id: Array<string>
allow: boolean,
)

transaction_id - a unique identifier returned from the peopleWaiting event listener. It is used to identify the specific participant who is waiting in the waiting room.

allow - a boolean value that indicates whether the participant should be allowed (true) or denied (false).

Host Lock Meeting Action

Meetings can be either open or locked. Open meetings can be joined by anyone who has the proper authentication credentials, while locked meetings require the host's approval for new participants to join. The current state of the meeting can be obtained through the meetingstate event. If a host wants to change the default state of the meeting room, they can use the hostLockMeetingAction function.

meetingsession.hostLockMeetingAction(lockState)

lockState - indicates whether the meeting should be locked (true) or unlocked (false).

After calling the hostLockMeetingAction function, a meetingstate event is fired to acknowledge the change in state. This event is received by all participants, including the local participant.

Host Manage Raise Hand

The hostManageRaiseHand function can be used by a host to lower the raised hand of a participant who has previously raised their hand during the meeting.

meetingsession.hostManageRaiseHand(participant_id)

participant_id - indicates which participants raise hand need to be taken down.

Host Manage Participant Stream

As a host, you have the ability to turn off or on the audio and video for all participants in the meeting. To mute all participants, the SDK will forcefully mute them and send an acknowledgement through the host event. To unmute, the SDK will only pass the host's request to the remote participants and leave it up to them to decide whether they want to turn on their audio and video.

meetingsession.hostManageParticipantsStream(participant_id, mute, stream)

Data type of hostManageParticipantsStream is as follows:

hostManageParticipantsStream(
participant_id: string,
mute: boolean,
stream: ”audio” | “video”
)

participant_id - id of participant whose audio/video to mute/unmute.

mute - indicates whether it’s a mute (OFF state) or unmute (ON state) action. true indicates mute and false indicates unmute.

stream - indicates if it is audio or video

Host Manage All Participants Audio

As a host, you have the ability to turn off or on the audio for all participants in the meeting. To mute all participants, the SDK will forcefully mute them and send a notification through the host event. To unmute, the SDK will only pass the host's request to the remote participants and leave it up to them to decide whether they want to turn on their microphone.

meetingsession.hostManageAllParticipantsAudio(muteState)

muteState - indicates whether the host should mute (true) or unmute (false) the audio of the remote participants.

After calling the hostManageAllParticipantsAudio function, a host event is fired for all remote participants to notify them about the change in audio status.

Host End Meeting

The hostEndMeeting function is a feature available to the host of a meeting. When called, it terminates the meeting for all participants, including the host.

meetingsession.hostEndMeeting()

After the hostEndMeeting function is called, a host event is fired for all remote participants to notify them that the meeting has been terminated.

Host Remove Participant

The hostRemoveParticipant function is used by a host to remove a participant from the meeting. When this function is called, the meeting will be ended for the remote participant.

meetingsession.hostRemoveParticipant(participant_id)

Participant_id - the id of the participant who should be removed from the meeting

After calling the hostRemoveParticipant function, a host event is fired for all remote participants to notify them about the removal. The removed participant can rejoin the meeting. This is the current limitation of the SDK and will be fixed in a future version.

Leave Meeting Session

leaveMeetingSession is used to end the meeting. It will close all the connections made on the SDK.

meetingsession.leaveMeetingSession()

Leave Meeting Session

leaveMeetingSession is used to end the meeting. It will close all the connections made on the SDK.

meetingsession.leaveMeetingSession()

Chat Methods

User Login

The userLogin function is used to log a user into the application. Once logged in, the user is able to start a new group or 1-1 chat,view the existing chat and perform other actions. This function allows users to authenticate and access the features and functionality of the SDK.

chatsession.userLogin(userName,password)
.then((res)=>{
// contains device list information
})
.catch((e)=>{// handle error})

userLogin type is as follows:

userLogin(
userName: string,
password: string
)
.then((res)=>{
//login success
})
.catch((e)=>{// login failed})

userName - userName is a string parameter.

password - password is a string parameter representing the user's password.

After login success response contains:

{
email: string
firstname: string
lastname: string
token: string
hoolva_user: string
}

email - email is a property that holds a string value, which can be any sequence of characters, representing the email of a user.

firstname - firstname is a property that holds a string value, which can be any sequence of characters, representing the first name of a user.

lastname - lastname is a property that holds a string value, which can be any sequence of characters, representing the last name of a user.

token - token is a property that holds a string value, which could be an authentication token that could be used to identify a user.

hoolva_user - hoolva_user is a property that holds a string value. This is to identify the user in hoolva.

Initialise Session

Initialise Session establish connection for the chats.

chatsession.initialiseSession()

This function is advised to be called right after userLogin. User and Group data is only available after calling this function. readyState event listener is triggered after calling this event which indicates User and Group data are available to fetch.

User Logout

To log out one needs to call the userLogout function. This will terminate the login session.

chatsession.userLogout().then((res) => {
//log out successfully
})

After a successful log out the function will return:

{
status: 'success'
message: 'Logged out successfully'
}

status - status is a property that holds a string value, It could represent the status of the operation indicating a successful logout.

message - message is a property that holds a string value, It could hold a message that provides more information about the status of the operation, such as providing feedback that the logout was successful.

Add Event Listener

On SDK numerous events are occurring at a time. Events need to be handled on client side for a proper working of the chat. Events can be listened using the addEventListener function. Eventlistener can be used as follows:

chatsession.addEventListener(key, callback)

Listeners should be added right after creating a ChatSession. When an event occurs concurrent callback function is called Meeting events

Possible keys for listeners are

readyState

Message

Fetch User Data

fetchUserData is used to get the details of the users under the tenant.

const group_details = chatsession.fetchUserData()

Returned data type is a follows:

Array<{
uuid: string,
status: string
profile_picture: string
presence: "online" | "offline",
unread_msg_count: number,
messages: Array<
{
uuid: string,
type: "text" | "reaction" | "file" | "system",
to: string,
tenant: string,
status: string,
seen: Array<string>,
reply_to: string | undefined,
other_info_map: Array<string>,
from: string,
forward_from: string | undefined,
category: "message” | edited_message”
|”seen_message”|”delete_message",
body: any,
a_mtime: number,
a_ctime: number
}
>,
lastname: string,
firstname: string,
display_name: string | undefined
},
>

uuid : - unique id of the member.

unread_msg_count : - total number of unread messages from that member.

status : - active / deactivate - if the user is a hoolva tenant user.

firstname : - first name of the member.

lastname : - last name of the member.

display_name : - display name of the member if the user has set any. If user didn’t set it it will be undefined.

profile_picture : - URL of the profile_picture of member.

presence : - indicates whether the member is offline or online.

messages : - Array of objects which contains the chat messages to that member. it only contains the last 8 messages. To fetch the previous messages you need to call getMessageHistory.

Message contains fields as:

  • to :- id of the remote member which user messaged.

  • from :- id of the user.

  • tenant :- tenant UUID.

  • status :- status of the message. Possible values are:

    sent :- indicates message has been sent to server.

    delivered_server :- indicates message has been received to server.

    delivered_remote_participant :- indicates message has been received to remote participant.

    read :- indicates message has been read by the remote participant.

  • a_ctime :- timestamp which indicates the creation time of the message.

  • a_mtime :- timestamp which indicates the last modified time of the message.

  • body :- content of the message.

  • category :- indicates the current status of the message. Possible values are:

    edited_message

    seen_message

    delete_message

  • other_info_map

  • forward_from

  • Vreply_toV

  • type :- indicates the type of the message. Possible values are "text" | "reaction" | "file" | "system".

Fetch Group Data

fetchGroupData is used to get the details of the group. it only returns the group if the member is in the group.

const group_details = chatsession.fetchGroupData()

Returned data type is as follows:

Array<{
uuid: string,
status: string
profile_picture: string
created_by: string
modified_by: string
unread_msg_count: number,
messages: Array<
{
uuid: string,
type: "text" | "reaction" | "file" | "system",
to: string,
tenant: string,
status: string,
seen: Array<{user_uuid:string, timestamp:number}>,
reply_to: string | undefined,
other_info_map: Array<string>,
from: string,
forward_from: string | undefined,
category: "message” | edited_message”
|”seen_message”|”delete_message",
body: any,
a_mtime: number,
a_ctime: number
}
>,
name : string,
description: string,
admin: Array<string>
a_mtime: number,
a_ctime: number
},
>

uuid : - unique id of the group.

unread_msg_count : - total number of unread messages from that group.

status : - used in hoolva user table.

name : - name of the group.

description : - Description of the group.

profile_picture : - URL of the profile_picture of the group.

created_by : - UUID of the member who created the group.

admin : - An array contains uuid of the admins.

modified_by : - UUID of the participant who recently changed the group settings.

a_ctime :- timestamp which indicates the creation of the group.

a_mtime :- timestamp which indicates the last modified time of the group settings.

messages : - Array of objects which contains the chat messages to that group. .it only contains the last 8 messages. To fetch the previous messages one need to call getMessageHistory.

Message contains fields as:

  • to :- id of the group which user messaged.

  • from :- id of the user.

  • tenant :- tenant UUID.

  • status :- status of the message. Possible values are:

    sent :- indicates message has been sent to server.

    delivered_server :- indicates message has been received to server.

    delivered_remote_participant :- indicates message has been received to remote participant.

    read :- indicates message has been read by the remote participant.

  • a_ctime :- timestamp which indicates the creation time of the message.

  • a_mtime :- timestamp which indicates the last modified time of the message.

  • body :- content of the message.

  • category :- indicates the current status of the message. Possible values are:

    edited_message

    seen_message

    delete_message

  • Seen

  • other_info_map

  • forward_from

  • reply_to

  • type :- indicates the type of the message. Possible values are "text" | "reaction" | "file" | "system".

Get Message History

​​getMessageHistory is used to fetch old messages from a group or one to one chats.

chatsession.getMessageHistory({
uuid:string,
count:string,
a_ctime?:number
})
.then((res)=>{
//contains old messages
})

uuid : - indicate the uuid of the group or person which history message needs to be fetched.

count : - indicates how many history messages needed to fetched.

a_ctime :- (optional) indicate the a_ctime of the oldest message which client have.

Publish Message

Publish message is used to send a message to group or one to one chat.

chatsession.publishMessage(
(message: string | Buffer),
(uuid: string),
(isGroup: boolean)
)

message : - content of the message.

uuid :- uuid of the group or member where message needed to be sent.

a_mtime :- indicates whether specified id belongs to group or not.

Add Group

addGroup is used to create a group. The members under the tenant can be added as group members.It’s not mandatory to add the user id to admin and member field. Because the user's UUID is automatically added into members and admin fields if it’s not passed from the client side.

chatsession.addGroup(groupData?:{
name: string,
members: Array<string>,
description?: string,
admin?: Array<string>,
status?: string,
})
.then((res)=>{
//contains group data
})

name : - name of the group.

members :- array with members_id which needs to be added on the meeting.

description :- (optional) indicates whether specified id belongs to group or not.

admin :- (optional) array with members_id which needs to be added as the admin in the meeting.

status : - (optional) indicates whether the group is active or not.

Delete Group

deleteGroup allows clients to delete a group. Only admin can delete the group.

chatsession.deleteGroup((uuid: string)).then((res) => {
//group has been successfully deleted
})

status : - UUID of the meeting.

Add Group Member

addGroupMember allows clients to add a member to the group . Only admin can delete the group.

chatsession
.addGroupMember((group_uuid: string), (members: Array<string>))
.then((res) => {
//members has been successfully added
})

uuid :- uuid of the group.

admin :- array of uuid which contains the id of members who needed to be added on group.

Add Group Admin Privilege

addGroupAdminPrivilege allows a group admin to give admin privileges to another member in the group. This can applied only to the existing members of the group.

chatsession
.addGroupAdminPrivilege((group_uuid: string), (admin: Array<string>))
.then((res) => {
//admin privilege has been successfully added
})

uuid :- uuid of the group.

admin :- array of uuid which contains the id of members who needs admin privileges.

Remove Group Admin Privilege

removeGroupAdminPrivilege allows clients to remove admin privileges for a member . Only an admin can remove the admin privileges of another member. This will not remove the member from the group.

chatsession
.removeGroupAdminPrivilege((group_uuid: string), (admin: Array<string>))
.then((res) => {
//admin privilege has been successfully removed
})

uuid :- uuid of the group.

admin :- array of uuid which contains the id of members who needed to be removed from admin title.

Delete Group Member

deleteGroupMember allows an admin user to remove a member from the group.

chatsession
.deleteGroupMember((group_uuid: string), (member_id: string))
.then((res) => {
//member has been successfully removed from the group.
})

uuid :- uuid of the group .

member_id :- UUID of member who needed to be removed from the group.

Close Connection

closeConnection closes all the connections made on SDK. it will also clear the cached data on the SDK.

chatsession.closeConnection()

Chat Listeners

Ready State

chatsession.addEventListener('readyState', (data) => {
//contains user token
})

readyState indicates that all the necessary connections have been made to start the application. Client should only fetch or update data after getting ready state event.

Returned data as follows:

{
uuid: string,
firstname: string,
lastname: string
}

uuid :- uuid of the logged in user.

firstname :- first name of the user.

lastname :- last name of the user.

Message

chatsession.addEventListener('message', (data) => {
//contains message data
})

All chat messages and system events and notifications will be passed through message event.

Returned data as follows:

{
isGroup: boolean,
message: {
from: string,
to: string,
uuid: string,
category: "message” | edited_message”|
”seen_message”|”delete_message",
body: string,
type: string,
tenant: string,
a_ctime: string,
status: string,
}

isGroup :- indicates if it is group or not.

message :- contains the properties of the message.

from :- UUID of the member who sent the message.

to :- UUID of the receiver. If it is group it will be group UUID.

uuid :- UUID of the message.

a_ctime :- timestamp which indicates the time of the creation of this message.

status :- indicates the message delivered status.

sent :- indicates message has been sent to server.

delivered_server :- indicates message has been received to server.

delivered_remote_participant :- indicates message has been received to remote participant.

read :- indicates message has been read by the remote participant.

body:- content of the message.

type :- indicates the type of the message. Possible values are "text" | "reaction" | "file" | "system".

category :- indicates the current status of the message. Possible values are:

edited_message

seen_message

delete_message