new Contact(id, userData)
Creates a new contact
Parameters:
| Name | Type | Description | 
|---|---|---|
| id | string | contact user id | 
| userData | Object | 
Fires:
- Contact#event:message
- Contact#event:conversationInvitation
- Contact#event:dataChannelInvitation
- Contact#event:data
- Contact#event:joinGroup
- Contact#event:leaveGroup
- Contact#event:whiteboardInvitation
- Contact#event:fileSentSuccessfully
- Contact#event:fileTransferProgress
- Contact#event:fileTransferError
- Contact#event:newMediaAvailable
- Contact#event:customEvent
- Contact#event:incomingCall
- Contact#event:incomingScreenSharingCall
- Contact#event:incomingScreenSharingCallInvitation
Returns:
this
- Type
- Contact
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 streamStream 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 optionsCallOptions Returns:- Type
- Call
 
- 
    fetchMediaList(session, options)
- 
    
    Fetches media shared with this contact via the cloud Parameters:Name Type Description sessionSession optionsobject 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 accountParameters:Name Type Default Description bearerTokenstring cloud bearerToken forceUpdateBoolean 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 sessionSession 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 groupString Returns:- Type
- Boolean
 
- 
    inviteTo(conversation, options)
- 
    
    Invites the contact to a conversation Parameters:Name Type Description conversationConversation optionsObject 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 userReturns:- Type
- Boolean
 
- 
    loadMessageHistory(session, options)
- 
    
    Loads message history for this contact from cloud Parameters:Name Type Description sessionSession optionsSessionHistoryOptions Returns:- Type
- Promise.<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
 
- 
    pushMedia(media, session, options)
- 
    
    Pushes media to be shared with this contact via the cloud Parameters:Name Type Description mediastring dataURI media sessionSession optionsobject Returns:- Type
- Promise.<CloudMediaInfo>
 
- 
    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
 
- 
    sendCustomEvent(event, content)
- 
    
    Sends custom data event to contact Parameters:Name Type Description eventstring event key contentObject 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 dataObject data to send Returns:- Type
- Promise.<void>
 
- 
    sendEventCenterDataRequest()
- 
    
    Sends request to retrieve contact's event center records. 
 Answer comes as CONTACT_EVENTCENTER_DATA_ANSWER eventReturns:- 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 fileInfoFileInfo relevant file information for the contact dataany 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 messageString message to send optionssendMessageOptions 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 conversationConversation actual conversation optionsJSON Returns:- Type
- Promise.<SentRemoteAccessInvitation>
 
- 
    sendWhiteboardInvitation(roomId, options)
- 
    
    Invites the contact to a whiteboard session Parameters:Name Type Description roomIdstring Whiteboard room id optionsobject PropertiesName Type Description contextobject cloudConversationIdstring Cloud Conversation ID (if any). Returns:- Type
- SentInvitation
 
- 
    shareScreen(options)
- 
    
    Share screen Parameters:Name Type Description optionsShareScreenOptions Returns:- Type
- Call
 
- 
    startDataChannel(options)
- 
    
    Invites the contact to a data channel session Parameters:Name Type Description optionsObject 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: objectProperties:Name Type Description eventstring event identifier contentobject conversationConversation 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: objectProperties:Name Type Description fileInfoFileInfo transferInformationTransferInformation 
- 
    fileTransferError
- 
    
    Fired during file transfer if an error occured Type: objectProperties:Name Type Description errorobject invitationIdstring 
- 
    fileTransferInvitation
- 
    
    Contact file transfer invitation event Type: ReceivedFileTransferInvitation
- 
    fileTransferProgress
- 
    
    Fired during file transfer Type: objectProperties:Name Type Description fileInfoFileInfo transferInformationTransferInformation 
- 
    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: objectProperties:Name Type Description contentstring content of the message uuidinteger message unique id timedate 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