Class: Contact

Contact

Contact

Designates another user which may or may not be currently connected

Extends

Methods


<static> getAvailableEvents()

Returns available events for this class

Returns:
Type
Array.<string>

call(stream, options)

Invites the contact to a 1-1 call

Parameters:
Name Type Description
stream Stream

Optional, if set the stream will be used during the call, otherwise it will be generated and it will be available through the Call#localStreamAvailable event

options CallOptions
Returns:
Type
Call

fetchMediaList(session, options)

Fetches media shared with this contact via the cloud

Parameters:
Name Type Description
session Session
options object
Returns:

mediaList in promise

Type
Promise.<Array.<object>>

fetchProfileInformation(bearerToken, forceUpdate)

Returns contact's cloud profile information
Profile information is accessible whether contact is online or offline as long as they have created an account

Parameters:
Name Type Default Description
bearerToken string

cloud bearerToken

forceUpdate Boolean false

forces profile update; optional, defaults to false

Returns:

Profile information in promise

Type
Promise.<object>

fetchUserData()

To use on a disconnected contact : returns contact's user data

Returns:

contact's userdata

Type
Object

fetchWebSessionInformation(session)

Fetches webSession information for this contact from cloud

Parameters:
Name Type Description
session Session
Returns:

Web session information in promise

Type
Promise.<WebSessionInfo>

getActiveStreams()

Returns contact's active streams

Returns:

Contact active streams

Type
Array.<Stream>

getId()

Returns contact's user id

Returns:

Contact id

Type
string

getPhotoUrl()

Returns contact's photo url

Returns:

contact's photo url

Type
string

getPreviousMessages()

Returns contact's previous messages

Returns:

previous conversation messages

Type
Array.<ConversationMessage>

getRemoteAccessSupport()

Returns contact's remote access support

Returns:

contact's remote access support

Type
Boolean

getUserData()

Returns contact's user data

Returns:

contact's userdata

Type
Object

getUsername()

Returns contact's username

Returns:

contact's username

Type
string

inGroup(group)

Checks whether the contact is known to be inside a group

Parameters:
Name Type Description
group String
Returns:
Type
Boolean

inviteTo(conversation, options)

Invites the contact to a conversation

Parameters:
Name Type Description
conversation Conversation
options Object
Returns:
Type
SentInvitation

isOnline()

Checks whether the contact is online or not
NOTE : A contact will be shown online only if it is currently in a group subscribed by the user

Returns:
Type
Boolean

loadMessageHistory(session, options)

Loads message history for this contact from cloud

Parameters:
Name Type Description
session Session
options SessionHistoryOptions
Returns:
Type
Promise.<void>

on(listener)

Adds a listener to a Observable event

Parameters:
Name Type Description
listener function
Inherited From:
Overrides:
Returns:

this instance for chaining

Type
Observable

pushMedia(media, session, options)

Pushes media to be shared with this contact via the cloud

Parameters:
Name Type Description
media string

dataURI media

session Session
options object
Returns:
Type
Promise.<CloudMediaInfo>

removeListener(eventType, listener)

Remove existing listener to Observable event

Parameters:
Name Type Description
eventType String
listener function
Inherited From:
Overrides:
Returns:

this instance for chaining

Type
Observable

sendCustomEvent(event, content)

Sends custom data event to contact

Parameters:
Name Type Description
event string

event key

content Object

data to send

Returns:
Type
Promise.<void>

sendData(data)

Sends data message to contact, prefer the use of Contact.sendFile() in case of large data objects

Parameters:
Name Type Description
data Object

data to send

Returns:
Type
Promise.<void>

sendEventCenterDataRequest()

Sends request to retrieve contact's event center records.
Answer comes as CONTACT_EVENTCENTER_DATA_ANSWER event

Returns:
Type
Promise.<void>

sendFile(fileInfo, data)

Invites the contact to a file transfer and sends the data once the contact accepts

Parameters:
Name Type Description
fileInfo FileInfo

relevant file information for the contact

data any

Data to be sent

Returns:

or null if an error occured

Type
SentInvitation

sendMessage(message, options)

Sends string message to contact

Parameters:
Name Type Description
message String

message to send

options sendMessageOptions
Returns:

Sent message uuid in promise

Type
Promise.<number>

sendRemoteAccessInvitation(conversation, options)

This function start all remote access process on contact.

Parameters:
Name Type Description
conversation Conversation

actual conversation

options JSON
Returns:
Type
Promise.<SentRemoteAccessInvitation>

sendWhiteboardInvitation(roomId, options)

Invites the contact to a whiteboard session

Parameters:
Name Type Description
roomId string

Whiteboard room id

options object
Properties
Name Type Description
context object
cloudConversationId string

Cloud Conversation ID (if any).

Returns:
Type
SentInvitation

shareScreen(options)

Share screen

Parameters:
Name Type Description
options ShareScreenOptions
Returns:
Type
Call

startDataChannel(options)

Invites the contact to a data channel session

Parameters:
Name Type Description
options Object
Returns:
Type
DataChannel

Events


conversationInvitation

Contact conversation invitation event

Type: ReceivedConversationInvitation

customEvent

Fired when a custom data event has been received from the contact

Type: object
Properties:
Name Type Description
event string

event identifier

content object
conversation Conversation

Associated conversation, field may not be present


data

Receive data from contact event

Type: object

dataChannelInvitation

Contact file transfer invitation event

Type: ReceivedDataChannelInvitation

fileSentSuccessfully

Fired when file was successfully sent to contact

Type: object
Properties:
Name Type Description
fileInfo FileInfo
transferInformation TransferInformation

fileTransferError

Fired during file transfer if an error occured

Type: object
Properties:
Name Type Description
error object
invitationId string

fileTransferInvitation

Contact file transfer invitation event

Type: ReceivedFileTransferInvitation

fileTransferProgress

Fired during file transfer

Type: object
Properties:
Name Type Description
fileInfo FileInfo
transferInformation TransferInformation

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

joinGroup

When contact joins a group

Type: string

leaveGroup

When contact leaves a group

Type: string

message

Receive message from contact event

Type: object
Properties:
Name Type Description
content string

content of the message

uuid integer

message unique id

time date

date of when the message was received


newMediaAvailable

When a new media has been pushed by the contact to the cloud and is available

Type: CloudMediaInfo

whiteboardInvitation

Contact whiteboard invitation event

Type: ReceivedWhiteboardInvitation