Create a new voicelayer object.

The following options are valid:

  • directory - location of the worker scripts
  • pingFrequency - How frequently a "ping" should be sent to the server in milliseconds. Defaults to 120000
  • pongTimeout - time in millisconds for the server to respond with pong before attempting to reconnect the WebSocket. Defaults to 6000.
  • unavailableTimeout - time in millisconds to attempt connecting before marking the connection as unavailable. Defaults to 10000.

Parameters

  • string key :

    API Key

  • string secret :

    API Secret

  • object = options :

    additional configuration options

Examples

var voicelayer = new VoiceLayer("mykey", "mysecret", {
  directory: "scripts/libs/voicelayersdk",
  pingFrequency: 30000,
  pongTimeout: 4000,
  unavailableTimeout: 6000
});

Instance members

Instance members

Instance members

Instance members

Instance members

Instance members

Instance members

Instance members

Instance members

Instance members

Instance members

Instance members

Callback used for REST API calls

Parameters

  • string error :

    the error description. Will be null if there are no errors

  • Array .< Object > results :

    The response from the server

  • Object = pages :

    The pages object for pagination

Examples

pages = {
  next: {},
  prev: {},
  first: {},
 last: {}
}
voicelayer.app.getUsers(callback, pages.next);

Callback with a single error parameter

Parameters

  • string error :

    the error description. Will be null if there are no errors

  • number duration :

    the duration of the last message

Callback with a single error parameter

Parameters

  • string = error :

    the error description

Callback for VoiceLayer events

Parameters

  • data = data :

    the event data

Callback used for REST API calls

Parameters

  • string error :

    the error description. Will be null if there are no errors

  • Object result :

    The response from the server