Class: ConversationClient

ConversationClient(params)

new ConversationClient(params)

The parent ConversationClient class.
Parameters:
Name Type Description
params object the settings to initialise the SDK
Properties
Name Type Default Description
debug Boolean false set mode to debug
url string 'nexmo_ws_url' Nexmo Conversation Websocket url
nexmo_api_url string Nexmo Conversation Api url
path string '/rtc' Nexmo Conversation Websocket url path suffix
rtcstats object set reporting for stream statistics (Websocket or internal event emit)
Properties
Name Type Default Description
ws_url string endpoint (websocket) to send rtc stats.
emit_events Boolean false receive rtcstats:report event
socket_io object configure socket.io
Properties
Name Type Default Description
forceNew Boolean true configure socket.io forceNew attribute
autoConnect Boolean true socket.io autoConnect attribute
reconnection Boolean true socket.io reconnection attribute
reconnectionAttempts number 5 socket.io reconnectionAttempts attribute
transports Array.<string> 'websocket' socket.io transports protocols
sync Array.<string> 'lite' {'lite' || 'full' || 'none'} after a successful login, synchronise conversations , include events or nothing
ips_url string 'ips_url' Nexmo IPS url for image upload
environment string 'production' development / production environment
iceServers object [{'stun:stun.l.google.com:19302'} iceServers for RTCPeerConnection
callstats object configure callstats.io integration
Properties
Name Type Default Description
enabled Boolean false
AppID string your callstats AppID
AppSecret string your callstats AppSecret
log_reporter object configure log reports for bugsnag tool
Properties
Name Type Default Description
enabled Boolean true
bugsnag_key string your bugsnag api key / defaults to Nexmo api key
Source:
Fires:

Methods

_updateTokenInStorage(token, username)

Update or Set the stored token
Parameters:
Name Type Description
token string the token to set
username string the username to whom the token belongs to
Source:

connect()

Connect from the cloud.
Source:

disconnect()

Disconnect from the cloud.
Source:

login(token) → {Promise.<Application>}

Login to the cloud.
Parameters:
Name Type Description
token string the login token
Source:
Returns:
- the application we logged in
Type
Promise.<Application>

logout()

logout from the cloud.
Source:

Events

connecting

Connecting event.
Source:
Example

Listen to websocket connecting event

    rtc.on("connecting", () => {
     console.log("connecting");
    });

disconnect

Disconnect event.
Source:
Example

Listen to websocket disconnect event

    rtc.on("disconnect", () => {
     console.log("disconnect");
    });

error

Error event.
Source:
Example

Listen to websocket error event

    rtc.on("error", (error) => {
     console.log("error", error);
    });

ready

Ready event.
Source:
Example

Listen to websocket ready event

    rtc.on("ready", () => {
     console.log("connection ready");
    });

reconnect

Reconnect event.
Source:
Example

Listen to websocket reconnect event

    rtc.on("reconnect", (retry_number) => {
     console.log("reconnect", retry_number);
    });

reconnecting

Reconnecting event.
Source:
Example

Listen to websocket reconnecting event

    rtc.on("reconnecting", (retry_number) => {
     console.log("reconnecting", retry_number);
    });