hyphenate_SDK3.0 4.0.0
hyphenate java IM SDK
Public Member Functions | List of all members
com.hyphenate.EMConnectionListener Interface Reference

Public Member Functions

void onConnected ()
 
void onDisconnected (final int errorCode)
 
default void onTokenExpired ()
 
default void onTokenWillExpire ()
 
default void onLogout (final int errorCode)
 

Detailed Description

The chat connection listener.

For the occasion of onDisconnected during unstable network condition, you don't need to reconnect manually, the chat SDK will handle it automatically.

There are only two states: onConnected, onDisconnected.

Note: We recommend not to update UI based on those methods, because this method is called on worker thread. If you update UI in those methods, other UI errors might be invoked. Also do not insert heavy computation work here, which might invoke other listeners to handle this connection event.

Register:
```java
EMClient.getInstance().addConnectionListener(mConnectionListener);
```

Unregister:
```java
EMClient.getInstance().removeConnectionListener(mConnectionListener);
```

Member Function Documentation

◆ onConnected()

void com.hyphenate.EMConnectionListener.onConnected ( )

Occurs when the SDK connects to the chat server successfully.

◆ onDisconnected()

void com.hyphenate.EMConnectionListener.onDisconnected ( final int  errorCode)

Occurs when the SDK disconnect from the chat server.

Note that the logout may not be performed at the bottom level when the SDK is disconnected.

Common errors are as follows: EMError#USER_REMOVED,EMError#USER_LOGIN_ANOTHER_DEVICE, EMError#SERVER_SERVICE_RESTRICTED,EMError#USER_KICKED_BY_CHANGE_PASSWORD and EMError#USER_KICKED_BY_OTHER_DEVICE

◆ onLogout()

default void com.hyphenate.EMConnectionListener.onLogout ( final int  errorCode)

◆ onTokenExpired()

default void com.hyphenate.EMConnectionListener.onTokenExpired ( )

Occurs when the token has expired.

Common errors are as follows: EMError#TOKEN_EXPIRED,EMError#TOKEN_WILL_EXPIRE,

◆ onTokenWillExpire()

default void com.hyphenate.EMConnectionListener.onTokenWillExpire ( )

Occurs when the token is about to expire.


The documentation for this interface was generated from the following file: