Package zendesk.chat
Interface ConnectionProvider
-
public interface ConnectionProviderA provider to access and control state of the web socket connection with the Zendesk Chat backend.You can access it as follows:
ConnectionProvider connectionProvider = Chat.INSTANCE.providers().connectionProvider();Make sure to initialize Zendesk Chat SDK first before accessing the providers, see
Chat.init(Context, String)for more details.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description voidconnect()Connects to the backend.voiddisconnect()Disconnects from the backend.ConnectionStategetConnectionState()Returns the current connection state.ObservationTokenobserveConnectionState(Observer<ConnectionState> observer)Registers an observer to be notified when connection state changes.
-
-
-
Method Detail
-
connect
void connect()
Connects to the backend.This method will only attempt to connect if not connecting or connected already and the account key provided is valid.
-
disconnect
void disconnect()
Disconnects from the backend.While disconnected and push token has been registered, the backend will start sending a push notifications until the session expires.
-
getConnectionState
ConnectionState getConnectionState()
Returns the current connection state.- See Also:
ConnectionState
-
observeConnectionState
ObservationToken observeConnectionState(Observer<ConnectionState> observer)
Registers an observer to be notified when connection state changes.- Parameters:
observer- the observer to be notified- Returns:
- observation token to cancel the registration
-
-