new Session()
Fires:
- Session#event:conversationMessage
- Session#event:conversationData
- Session#event:contactMessage
- Session#event:contactData
- Session#event:rawData
- Session#event:conversationInvitation
- Session#event:incomingCall
- Session#event:disconnect
- Session#event:error
- Session#event:reconnection
- Session#event:reconnecting
- Session#event:contactListUpdate
- Session#event:conversationJoinRequest
- Session#event:whiteboardInvitation
- Session#event:whiteboardRoomMemberUpdate
- Session#event:fileTransferInvitation
- Session#event:dataChannelInvitation
- Session#event:newMediaAvailableFromContact
- Session#event:customEvent
- Session#event:incomingScreenSharingCall
- Session#event:pointerSharingInvitation
- Session#event:pointerLocationChanged
- Session#event:incomingScreenSharingCallInvitation
- Session#event:cloudEventOccurred
Extends
Methods
-
<static> getActiveSession()
-
Returns currently active session
Returns:
- Type
- Session
-
<static> getAvailableEvents()
-
Returns available events for this class
Returns:
- Type
- Array.<string>
-
allowMultipleCalls(value)
-
Set the possibilty for the user to have multiple calls at the same time (default true)
Parameters:
Name Type Description valueboolean Returns:
- Type
- void
-
cloudRequest(url, params, method)
-
A promise for generic ApiRTC cloud platform REST requests
Avoid using this method unless you know what you are doingParameters:
Name Type Description urlString paramsObject methodString Returns:
json result in promise
- Type
- Promise.<object>
-
createConversation(conversationName, options)
-
Gets a conversation from name for N-N communication.
Deprecated in favor of Session#getOrCreateConversation.
Parameters:
Name Type Description conversationNameString can be set to null to generate a random conversation name
optionsObject - Deprecated:
-
- Yes
Returns:
returned conversation
- Type
- Conversation
-
disconnect(options)
-
Disconnects this session
Session will no longer receive events once disconnectedParameters:
Name Type Description optionsDisconnectOptions Returns:
- Type
- Promise.<void>
-
getActiveConferences(options)
-
Gets all currently joined conferences
Parameters:
Name Type Description optionsObject Returns:
returned active conferences
- Type
- Object.<string, Conference>
-
getActiveConversations(options)
-
Gets all currently joined conversations
Parameters:
Name Type Description optionsObject Returns:
returned active conversations
- Type
- Object.<string, Conversation>
-
getApzToken()
-
Returns Apizee token associated to the session
Returns:
token
- Type
- string
-
getCall()
-
Returns call with Id
Returns:
call
- Type
- Object.<string, Call>
-
getCalls()
-
Returns call list
Returns:
call list
- Type
- Object.<string, Call>
-
getConference(conferenceName, options)
-
Gets a conference from name for enterprise N-N communication.
Deprecated in favor of Session#getOrCreateConversation.
Parameters:
Name Type Description conferenceNamestring can be set to null to generate a random conference name
optionsObject - Deprecated:
-
- Yes
Returns:
returned conference
- Type
- Conference
-
getContact(id)
-
Returns contact from id. Deprecated : please use getOrCreateContact
Parameters:
Name Type Description idString - Deprecated:
-
- Yes
Returns:
contact
- Type
- Contact
-
getContactFromWebSession(webSessionId)
-
Gets contact from a websessionId
Parameters:
Name Type Description webSessionIdstring Returns:
Associated contact in promise
- Type
- Promise.<Contact>
-
getContacts(group)
-
Returns contact list
Parameters:
Name Type Description groupString If defined, restrict list to user inside defined group
Returns:
contact list
- Type
- Object.<string, Contact>
-
getContactsArray(group)
-
Returns contact list array
Parameters:
Name Type Description groupString If defined, restrict list to user inside defined group
Returns:
contact list array
- Type
- Array.<Contact>
-
getConversation(conversationName, options)
-
Gets a conversation from name for N-N communication.
Deprecated in favor of Session#getOrCreateConversation.
Parameters:
Name Type Description conversationNameString can be set to null to generate a random conversation name
optionsObject - Deprecated:
-
- Yes
Returns:
returned conversation
- Type
- Conversation
-
getId()
-
Returns this session's id
Returns:
id
- Type
- string
-
getOnlineContactsArray(group)
-
Returns online contact list array
Parameters:
Name Type Description groupString If defined, restrict list to user inside defined group
Returns:
online contact list array
- Type
- Array.<Contact>
-
getOrCreateConference(name, options)
-
Gets or creates a conference for a given name.
If the given name matches the pattern ([^:]+): then a Conference is returned,
otherwise a Conversation is returned.
Note that options are only used to create Conference, i.e. if the Conference
already exists, options are ignored.Parameters:
Name Type Description nameString Conference name.
optionsobject Properties
Name Type Default Description meshModeEnabledboolean false Whether the mesh mode is enabled.
meshOnlyEnabledboolean false Whether the mesh mode is the only mode allowed, i.e. no transition to another mode will occur.
Returns:
A Conversation or a Conference, depending on the given name.
- Type
- Conversation | Conference
-
getOrCreateContact(id)
-
Returns contact from id. Contact will be created if doesn't exist.
Parameters:
Name Type Description idString Returns:
contact
- Type
- Contact
-
getOrCreateConversation(name, options)
-
Gets or creates a Conversation for a given name.
If the given name matches the pattern ([^:]+): then a Conference is returned,
otherwise a Conversation is returned.
Note that options are only used to create Conversation, i.e. if the Conversation
already exists, options are ignored.Parameters:
Name Type Description namestring Conversation name.
optionsobject Properties
Name Type Default Description e2eeE2EEOptions Whether end-to-end encryption is enabled.
meshModeEnabledboolean false Whether the mesh mode is enabled.
meshOnlyEnabledboolean false Whether the mesh mode is the only mode allowed, i.e. no transition to another mode will occur.
moderationEnabledboolean false Whether moderation is enabled for the new Conversation.
moderatorboolean false Whether the UserAgent shall be added to the list of moderators.
Returns:
A Conversation or a Conference, depending on the given name.
- Type
- Conversation | Conference
-
getPhotoUrl()
-
Gets this session's photo URL
Returns:
photo URL on success, null otherwise.
- Type
- string
-
getPresenceGroup()
-
Gets presence group in an array
Returns:
Presence group array
- Type
- Array.<string>
-
getSubscribedPresenceGroup()
-
Gets all subscribed presence group in an array
Returns:
Subscribed presence group array
- Type
- Array.<string>
-
getToken()
-
Returns this session's token if this is a cloud user's session, otherwise returns null
Returns:
token
- Type
- string
-
getUserAgent()
-
Returns this session's user agent
Returns:
ua
- Type
- UserAgent
-
getUserData()
-
Gets user data for this user session
Returns:
contact's userdata
- Type
- Object
-
getUsername()
-
Gets this session's username
Returns:
contact's username
- Type
- string
-
getWhiteboardClient()
-
Returns whiteboard client
Returns:
WhiteboardClient
- Type
- WhiteboardClient
-
joinConversationSpace(conversationSpace)
-
Join conversationSpace
Parameters:
Name Type Description conversationSpaceString conversationSpace to join
Returns:
- Type
- Void
-
joinGroup(group)
-
Joins and subscribes to a group
The user will be visible to both users inside the group and users who subscribed to itParameters:
Name Type Description groupstring Presence group to join
Returns:
- Type
- void
-
joinPointerSharingRoom(roomId)
-
Joins a pointer sharing room identified by a given roomId.
Parameters:
Name Type Description roomIdstring Returns:
- Type
- Promise.<PointerSharingRoom>
-
leaveConversationSpace(conversationSpace)
-
Leave conversationSpace
Parameters:
Name Type Description conversationSpaceString conversationSpace to leave
Returns:
- Type
- Void
-
leaveGroup(group)
-
Leaves and unsubscribes to a group
Users within the group and users who subscribed to it will be notifiedParameters:
Name Type Description groupString Presence group to leave
Returns:
- Type
- Void
-
on(listener)
-
Adds a listener to a Observable event
Parameters:
Name Type Description listenerfunction - Inherited From:
- Overrides:
Returns:
this instance for chaining
- Type
- Observable
-
removeListener(eventType, listener)
-
Remove existing listener to Observable event
Parameters:
Name Type Description eventTypeString listenerfunction - Inherited From:
- Overrides:
Returns:
this instance for chaining
- Type
- Observable
-
sendRawData(contact, data)
-
Promise to send rawData for older apps compatibility
Parameters:
Name Type Description contactContact dataObject Returns:
- Type
- Promise.<void>
-
setCallStatsMonitoringEnabled(enabled, interval)
-
Enables call stats monotoring.
Parameters:
Name Type Description enabledenabled Whether to enable call stats monitoring
intervalinterval Update interval in milliseconds
Returns:
- Type
- void
-
setMCUServer(server)
-
Sets MCU server to be used
Clients on different MCU servers will be unable to see each other's streams in a conversation / conference even if they are in the same roomParameters:
Name Type Description serverstring Returns:
- Type
- void
-
setPhotoUrl(url)
-
Set session's photo URL
Parameters:
Name Type Description urlstring Returns:
- Type
- void
-
setQualityEvaluatingEnabled(enabled, interval)
-
Enables quality evaluating.
Parameters:
Name Type Description enabledenabled Whether to enable quality evaluating
intervalinterval Update interval in milliseconds
Returns:
- Type
- void
-
setUserData(userData)
-
Sets user data for this user session
User data is visible from other usersParameters:
Name Type Description userDataObject Returns:
- Type
- void
-
setUsername(username)
-
Set session's username
Parameters:
Name Type Description usernamestring Returns:
- Type
- void
-
startRecordingOutgoingStream(mode, filename)
-
Starts recording the first user's outgoing stream
NOTE : This function is present for backward compatibility purposes, prefer the use of a recorded call or Stream.startRecord() insteadParameters:
Name Type Description modestring can be 'AUDIO-ONLY', 'VIDEO-ONLY', 'AUDIO-VIDEO'
filenamestring Returns:
- Type
- void
-
stopRecordingOutgoingStream()
-
Stops the recording started with Session.startRecordingOutgoingStream() and returns information to get the record from the server
NOTE : This function is present for backward compatibility purposes, prefer the use of a recorded call or Stream.startRecord() insteadReturns:
Record information in promise
- Type
- Promise.<RecordInformation>
-
subscribeToGroup(group)
-
Subscribe to a group and know who is present in the group
Unless you also joined the group, the user will not be visible to others within this groupParameters:
Name Type Description groupstring Presence group to subscribe to
Returns:
- Type
- void
-
unsubscribeToGroup(group)
-
Unsubscribe to a group, the session will no longer receive events from user joining and leaving this group
Parameters:
Name Type Description groupstring Presence group to unsubscribe to
Returns:
- Type
- void
Events
-
contactData
-
Fired when data is received from a contact
Type: object
Properties:
Name Type Description senderContact contentobject -
contactListUpdate
-
Fired when the contact list has been updated
The contact list is updated when a contact leaves a group, joins a group or if its user data changedType: object
-
contactMessage
-
Fired when a message is received from a contact
Type: object
Properties:
Name Type Description senderContact contentstring content of the message
uuidinteger message unique id
timedate date of when the message was received
-
conversationData
-
Fired when conversation data is received
Type: object
Properties:
Name Type Description senderContact conversationConversation contentobject -
conversationInvitation
-
Fired when a conversation invitation is received
Type: ReceivedConversationInvitation
-
conversationJoinRequest
-
Fired when a conversation join request is received
This event is fired only if the user is the moderator from the conversationType: ReceivedConversationJoinRequest
-
conversationMessage
-
Fired when a conversation message is received
Type: object
Properties:
Name Type Description senderContact contentstring content of the message
conversationConversation -
customEvent
-
Fired when a custom data event has been received
Type: object
Properties:
Name Type Description eventstring event identifier
contentobject senderContact conversationConversation Associated conversation, field may not be present
-
dataChannelInvitation
-
Fired when a data channel invitation is received
Type: ReceivedDataChannelInvitation
-
disconnect
-
Fired on disconnection with CCS server
Type: Void
-
error
-
Fired when an error is detected on connection with CCS server
Type: Void
-
fileTransferInvitation
-
Fired when a file transfer invitation is received
Type: ReceivedFileTransferInvitation
-
incomingCall
-
Fired when user receives an incoming call
Type: ReceivedCallInvitation
-
incomingScreenSharingCall
-
Fired when user receives an incoming screenSharing call
Type: Call
-
incomingScreenSharingCallInvitation
-
Fired when user receives an incoming screenSharing call Invitation
Type: ReceivedCallInvitation
-
newMediaAvailableFromContact
-
Fired when a new media is available from a contact
Type: object
Properties:
Name Type Description senderContact mediaCloudMediaInfo -
pointerLocationChanged
-
Fired when the pointer location changed for a contact.
Type: object
Properties:
Name Type Description senderContact sourceobject xnumber ynumber dataobject -
pointerSharingInvitation
-
Fired when a pointer sharing invitation is received
Type: ReceivedPointerSharingInvitation
-
rawData
-
Fired when raw data is received from a contact (for older apiRTC app compatibility)
Type: object
Properties:
Name Type Description senderContact contentobject -
reconnecting
-
Fired when a new connection to server is tried
Type: Void
-
reconnection
-
Fired when connectivity to the network has been recovered
Type: Void
-
whiteboardInvitation
-
Fired when a whiteboard session invitation is received
Type: ReceivedWhiteboardInvitation
-
whiteboardRoomMemberUpdate
-
Fired when a member connect or disconnect from whiteboard room.
Type: object
Properties:
Name Type Description roomIdstring event identifier
statusstring online / offline
contactsArray.<Contact> contacts updated
-
whiteboardRoomMemberUpdate
-
Fired when a member connect or disconnect from whiteboard room
Type: object
Properties:
Name Type Description roomIdstring event identifier
statusstring online / offline
contactsArray.<Contact> contacts updated