连接

连接状态监听器,可以监听到 SDK 连接状态的改变

使用 IMKit,可以设置并实现此 Delegate 监听连接状态的改变;

注意

使用IMLib,请使用RCIMClient中的RCIMClientReceiveMessageDelegate监听消息接收,而不要使用此方法。

@protocol RCIMConnectionStatusDelegate <NSObject>

@property(nonatomic, weak) id<RCIMConnectionStatusDelegate> connectionStatusDelegate;
参数 类型 说明
status RCConnectionStatus SDK与融云服务器的连接状态

- (void)onRCIMConnectionStatusChanged:(RCConnectionStatus)status;
代码示例:
- (void)onRCIMConnectionStatusChanged:(RCConnectionStatus)status {
if (status == ConnectionStatus_Connected) {

} else if (status == ConnectionStatus_KICKED_OFFLINE_BY_OTHER_CLIENT &&

} else if (status == ConnectionStatus_TOKEN_INCORRECT) {

} else if (status == ConnectionStatus_DISCONN_EXCEPTION) {

}

获取当前SDK的连接状态


- (RCConnectionStatus)getConnectionStatus;