Package zendesk.chat
Interface ConnectionProvider
-
public interface ConnectionProvider
A 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 void
connect()
Connects to the backend.void
disconnect()
Disconnects from the backend.ConnectionStatus
getConnectionStatus()
Gets the current connection status.void
observeConnectionStatus(ObservationScope observationScope, <any> observer)
Registers an observer to be notified when connection status 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.
-
getConnectionStatus
ConnectionStatus getConnectionStatus()
Gets the current connection status.ConnectionStatus#DISCONNECTED
by default.
-
observeConnectionStatus
void observeConnectionStatus(ObservationScope observationScope, <any> observer)
Registers an observer to be notified when connection status changes.- Parameters:
observationScope
- the lifespan of the observationobserver
- the observer to be notified
-
-