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 DISCONNECTEDString disconnected Client is offline and no connection attempt in process. CONNECTINGString connecting Client is offline and connection attempt is in process. CONNECTEDString connected Client is online and ready. ERRORString error Client connection is in the erroneous state. DENIEDString 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 Identifierstring Returns:
- Type
- Promise.<Document>
-
list(Identifier)
-
Open a List by identifier, or create one if none exists
Parameters:
Name Type Description Identifierstring Returns:
- Type
- Promise.<List>
-
map(Identifier)
-
Open a Map by identifier, or create one if none exists
Parameters:
Name Type Description Identifierstring Returns:
- Type
- Promise.<Map>
Type Definitions
-
ClientOptions
-
These options can be passed to Client constructor
Type:
- Object
Properties:
Name Type Argument Default Description logLevelString <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 ConnectionStateClient#connectionState