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(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
forceUpdate Boolean false

forces profile update; optional, defaults to false

Returns:

Profile information in promise

Type
Promise.<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>

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:
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:
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, options)

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

options Object
Returns:
Type
Promise.<void>

sendFile(fileInfo, data, options)

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

options Object
Returns:
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>

sendWhiteboardInvitation(roomId, options)

Invites the contact to a whiteboard session

Parameters:
Name Type Description
roomId String

whiteboard room id

options Object
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: Call

incomingScreenSharingCall

Fired when user receives an incoming screenSharing call

Type: Call

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