Class: Client

Client

Client for Twilio Data Synchronization service

new Twilio.Sync.Client(AccessManager, options)

Parameters:
Name Type Description
AccessManager AccessManager Twilio access manager instance
options Client#ClientOptions Options to customize the Client
Properties:
Name Type Description
accessManager AccessManager The Client's AccessManager
connectionState Client#connectionState Connection state info

Members


<readonly> connectionState :String

Service connection state
Type:
  • String
Properties:
Name Type Default Description
DISCONNECTED String disconnected Client is offline and no connection attempt in process.
CONNECTING String connecting Client is offline and connection attempt is in process.
CONNECTED String connected Client is online and ready.
ERROR String error Client connection is in the erroneous state.
DENIED String denied Client connection is denied because of invalid token

<readonly> version :String

Current version of Sync client.
Type:
  • String

Methods


document(Identifier)

Open a SyncDocument by identifier, or create one if none exists
Parameters:
Name Type Description
Identifier string
Returns:
Type
Promise.<Document>

list(Identifier)

Open a List by identifier, or create one if none exists
Parameters:
Name Type Description
Identifier string
Returns:
Type
Promise.<List>

map(Identifier)

Open a Map by identifier, or create one if none exists
Parameters:
Name Type Description
Identifier string
Returns:
Type
Promise.<Map>

Type Definitions


ClientOptions

These options can be passed to Client constructor
Type:
  • Object
Properties:
Name Type Argument Default Description
logLevel String <optional>
'error' The level of logging to enable. Valid options (from strictest to broadest): ['silent', 'error', 'warn', 'info', 'debug', 'trace']

Events


connectionStateChanged

Fired when connection state has been changed.
Parameters:
Name Type Description
ConnectionState Client#connectionState