createKandy

The Kandy.js SDK Factory. Create an instance of the SDK by calling this factory with the the desired configurations.

createKandy(configs: Object)
Parameters
configs (Object) The configuration object.
Example
// Instantiate the SDK.
let kandy = createKandy({
    authentication: { ... },
    logs: { ... },
    ...
});
// Use the Kandy API.
kandy.on( ... );

configs

The configuration object. This object defines what different configuration values you can use when instantiating the SDK.

configs
Configurations By Feature
configs.logs
configs.notifications
configs.authentication
configs.call
configs.connectivity

Events

Events
API Functions
on(type, listener)
off(type, listener)
subscribe(listener)
unsubscribe(listener)

Authentication

Kandy's authentication feature handles connecting and disconnecting from any backend services that the SDK deals with. As well, it handles and stores authentication information on the behalf of the user. This allows the user to interact with the server without worrying about authenticating.

Authentication
API Functions
getUserInfo()
getConnection()
subscriptionStates

Calls

Kandy's call feature is used to make audio and video calls between Kandy users, or to PSTN phones and SIP endpoints. Kandy will store meta-information about each call made during the current session in internal state, which can be accessed via the call getter functions.

Call functions are namespaced beneath 'call' on the returned Kandy object.

Calls
API Functions
makeAnonymous(callee, credentials?, callOptions?)
getAll()
getById(callId)
states
mediaStates
end(callId)
mute(callId)
unmute(callId)
startVideo(callId, options?)
stopVideo(callId)
hold(callId)
unhold(callId)
startScreenshare(callId, options)
stopScreenshare(callId)
sendDTMF(callId, tone)
Events
call:start
call:stateChange
call:mediaStateChange
call:screenshareChange
call:error

Media

Kandy's media features are used to control WebRTC Media Devices.

Media functions are namespaced beneath 'media' on the returned Kandy object.

Media
API Functions
setDefaultDevices(devices)
getDevices()
Events
devices:defaultsChange
media:initialize

Connectivity

Kandy's connection feature is used to connect and maintain connections between the SDK and one or more backend servers.

Connectivity functions are namespaced beneath 'connectivity' on the returned Kandy object.

Connectivity
API Functions
getSocketState(platform)
enableConnectivityChecking(enable)
Events
ws:change

Notification

Notification
API Functions
registerPush(params)
deregisterPush()
enableWebsocket(enable)
Events
notifications:change
notifications:error

sdpHandlers

A List of handlers for manipulating the SDP Object

sdpHandlers
API Functions
createCodecRemover()

Logger

The internal logger used to provide information about the SDK's behaviour. Provide a log level as part of the SDK configuration (see configs.logs) to use the logger.

Logger
API Functions
levels

Config

An interface for getting and updating the configuration Object.

Config
API Functions
getConfig()
updateConfig(newConfigValues)

KandyError

The Kandy error object. Provides information about an error that occurred in the SDK.

KandyError
Properties
code (string) : The code of the error. If no code is known, this will be a string 'NO_CODE'.
message (string) : A human-readable message to describe the error. If no message is known, this will be a string 'An error occured'.

AudioBridge

Kandy's audio bridge feature allows multiple audio calls to be bridged together for a local three-way call.

Audio bridge functions are namespaced beneath 'audioBridge' on the returned Kandy object.

AudioBridge
API Functions
create()
close(bridgeId)
addCall(bridgeId, callId)
removeCall(bridgeId, callId)
mute(bridgeId)
unmute(bridgeId)
getAll()
Events
audioBridge:change
audioBridge:error