Class: NexmoClient

NexmoClient(params)

new NexmoClient(params)

The parent NexmoClient 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
conversations_page_config object configure paginated requests for conversations
Properties
Name Type Default Description
page_size number 10 the number of resources returned in a single request list
order string asc 'asc' or 'desc' ordering of resources (usually based on creation time)
cursor string cursor parameter to access the next or previous page of a data set
events_page_config object configure paginated requests for events
Properties
Name Type Default Description
page_size number 10 the number of resources returned in a single request list
order string asc 'asc' or 'desc' ordering of resources (usually based on creation time)
event_type string the type of event used to filter event requests. Supports wildcard options with :* eg. 'members:*'
Source:
Fires:

Methods

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);
    });