Client
Client for managing the connection to the Voximplant cloud.
Methods
Registers a handler for the specified event.
One event can have more than one handler; handlers are executed in order of their registration.
Parameters
eventName:
Event name
listener:
(event: ClientDisconnected) => void | Promise<void>
Handler function that is triggered when an event of the specified type occurs
options:
Object that specifies characteristics about the event listener
Returns
type:
void
Connects to the Voximplant Cloud.
Returns a promise that is resolved when the connection is established.
Parameters
options:
Connect options.
Returns
type:
Promise<void>
Disconnects from the Voximplant Cloud.
Returns a promise that is resolved when the connection is closed.
Returns
type:
Promise<void>
Handles an incoming push notification payload.
Parameters
pushPayload:
Push notification payload.
Returns
type:
void
Logs in to the Voximplant Cloud with a password.
Returns a promise that is resolved to a LoginResult object.
Parameters
username:
string
Username.
password:
string
Password.
Returns
type:
Promise<LoginResult>
Logs in to the Voximplant Cloud with an access token.
Returns a promise that is resolved to a LoginResult object.
Parameters
username:
string
Username.
accessToken:
string
Access token.
Returns
type:
Promise<LoginResult>
Logs in to the Voximplant Cloud with a one-time key.
Returns a promise that is resolved to a LoginResult object.
Parameters
username:
string
Username.
hash:
string
One-time key hash.
Returns
type:
Promise<LoginResult>
Refreshes login tokens required for Client.loginWithAccessToken.
Returns a promise that is resolved to a LoginTokens object.
Parameters
username:
string
Username.
refreshToken:
string
Refresh token.
Returns
type:
Promise<LoginTokens>
Registers the device for push notifications.
Parameters
config:
Push notification configuration.
Returns
type:
Promise<void>
Removes a previously registered handler for the specified event.
Parameters
eventName:
Event name
listener:
(event: ClientDisconnected) => void | Promise<void>
Handler function to remove from the event target
Returns
type:
void
Generates a one-time login key for the automated login process.
For additional information please see the guide.
Returns a promise that is resolved to the one-time key string.
Parameters
username:
string
Username.
Returns
type:
Promise<string>
Unregisters the device from push notifications.
Parameters
config:
Push notification configuration.
Returns
type:
Promise<void>
Props
Watchable property that allows getting the current client state and observing its changes.