hyphenate_SDK3.0 4.0.0
hyphenate java IM SDK
|
Public Member Functions | |
void | onConnected () |
void | onDisconnected (final int errorCode) |
default void | onTokenExpired () |
default void | onTokenWillExpire () |
default void | onLogout (final int errorCode) |
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); ```
void com.hyphenate.EMConnectionListener.onConnected | ( | ) |
Occurs when the SDK connects to the chat server successfully.
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
default void com.hyphenate.EMConnectionListener.onLogout | ( | final int | errorCode | ) |
Occurs when the UNDERLYING SDK logs out.
Common errors are as follows: EMError#USER_LOGIN_ANOTHER_DEVICE,EMError#USER_REMOVED, EMError#USER_BIND_ANOTHER_DEVICE,EMError#SERVER_SERVICE_RESTRICTED, EMError#USER_LOGIN_TOO_MANY_DEVICES,EMError#USER_KICKED_BY_CHANGE_PASSWORD, EMError#USER_KICKED_BY_OTHER_DEVICE
errorCode |
default void com.hyphenate.EMConnectionListener.onTokenExpired | ( | ) |
Occurs when the token has expired.
Common errors are as follows: EMError#TOKEN_EXPIRED,EMError#TOKEN_WILL_EXPIRE,
default void com.hyphenate.EMConnectionListener.onTokenWillExpire | ( | ) |
Occurs when the token is about to expire.