[WKSDK shared].connectionManager接口。
配置
[WKSDK shared].options
连接
断开
监听连接状态
下一步
消息收发
学习如何收发消息
频道管理
管理频道和群组
会话管理
处理会话列表
多媒体消息
处理图片、语音、视频消息
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
WuKongIM iOS SDK 连接管理和状态监听指南
[WKSDK shared].connectionManager接口。
[WKSDK shared].options.host = @"xxx.xxx.xxx.xxx"; // IM通信端的IP
[WKSDK shared].options.port = 5100; // IM通信端的TCP端口
// 设置IM连接认证信息
[WKSDK shared].options.connectInfoCallback = ^WKConnectInfo * _Nonnull{
WKConnectInfo *connectInfo = [WKConnectInfo new];
connectInfo.uid = "xxxx"; // 用户uid (业务服务端在IM通讯端登记了的uid)
connectInfo.token = "xxxx"; // 用户的token (业务服务端在IM通讯端登记了的token)
return connectInfo;
};
[WKSDK shared].options
// 连接
[[WKSDK shared].connectionManager connect];
// 断开连接 NO: SDK保持重连机制 YES: SDK将不再进行重连
[[WKSDK shared].connectionManager disconnect:NO];
[WKSDK.shared.connectManager addDelegate:self]; // WKConnectionManagerDelegate
// ---------- WKConnectionManagerDelegate ----------
/**
连接状态监听
*/
-(void) onConnectStatus:(WKConnectStatus)status reasonCode:(WKReason)reasonCode {
if(status == WKConnetced) {
NSLog(@"连接成功!");
}
}
