3 Star 3 Fork 2

Siter / cimkit

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

cimkit

介绍

CimKit是基于CIM项目框架下的iOS端SDK。配合CIM服务我们可以快速搭建属于自己的推送系统、IM系统。

Requirements

项目要求 :

  • iOS10
  • ARC

Podfile

use_frameworks!

pod 'CimKit'

然后运行一下命令安装:

$ pod install

使用方法

1. 导入头文件
#import "CIMHeader.h"
2. 初始化配置
[[CIMService instance] configHost:@"192.168.51.197" onPort:23456];
3. 绑定用户
[[CIMService instance] connectionBindUserId:@"111111"];
4. 添加监听回调
[[CIMService instance] addMessageObserver:self];
[[CIMService instance] addConnectionObserver:self];
5. 移除回调
[[CIMService instance] removeMessageObserver:self];
[[CIMService instance] removeConnectionObserver:self];
6. CIMPeerMessageObserver回调说明
/// 接受到消息
/// @param msg msg description
-(void)cimHandleMessage:(CIMMessageModel * _Nonnull)msg;

/// 消息解析失败
/// @param data data description
-(void)cimHandleMessageError:(NSData * _Nonnull)data;
7. CIMConnectionObserver回调说明
/// 用户绑定成功
/// @param bindSuccess bindSuccess description
-(void)cimDidBindUserSuccess:(BOOL)bindSuccess;

/// 连接成功
-(void)cimDidConnectSuccess;

/// 断开连接
-(void)cimDidConnectClose;

/// 连接失败
/// @param error res description
-(void)cimDidConnectError:(NSError *_Nullable)error;
8. 其他方法说明
+(CIMService*)instance;

/// 配置IM服务器
/// @param host host description
/// @param port port description
-(void)configHost:(NSString *)host onPort:(NSInteger)port;

/// 连接服务器并绑定用户
/// @param userId userId description
-(void)connectionBindUserId:(NSString *)userId;

/// 添加消息监听回调
/// @param observer observer description (可添加多个)不同时记得Remove
-(void)addMessageObserver:(id<CIMPeerMessageObserver>)observer;

/// 添加连接状态监听回调
/// @param observer observer description (可添加多个)不同时记得Remove
-(void)addConnectionObserver:(id<CIMConnectionObserver>)observer;

/// 移除监听
/// @param observer observer description
-(void)removeMessageObserver:(id<CIMPeerMessageObserver>)observer;

/// 移除监听回调
/// @param observer observer description
-(void)removeConnectionObserver:(id<CIMConnectionObserver>)observer;

/// 退出后台 断开连接
-(void)enterBackground;

/// 进入前台重新连接
-(void)enterForeground;

/// 重新连接
-(void)reconnect;

/// 断开连接
-(void)disconnect;

帮助和建议

如果你有好的建议和帮助您可以直接联系我:siterwu@gmail.com

Todo

1、数据缓存 2、通用UI组件 3、推送集成

Comments ( 0 )

Sign in for post a comment

About

CimKit是基于CIM项目框架下的iOS端SDK。配合CIM服务我们可以快速搭建属于自己的推送系统、IM系统。 spread retract
Objective-C
Apache-2.0
Cancel

Releases

No release

Gitee Metrics

Contributors

All

Activities

load more
can not load any more
Objective-C
1
https://git.oschina.net/Siter/cimkit.git
git@git.oschina.net:Siter/cimkit.git
Siter
cimkit
cimkit
master

Search