JMSGChatRoom Class Reference
| Inherits from | NSObject | 
|---|---|
| Declared in | JMSGChatRoom.h | 
Overview
- 聊天室 *
 主要特点
*
- 聊天室的消息没有推送通知和离线保存,也没有常驻成员的概念,只要进入聊天室即可接收消息,开始聊天, 一旦退出聊天室,不再会接收到任何消息、通知和提醒。 *
 发送消息
*
- 聊天室消息的发送与单聊、群聊是一样的,通用的发送接口 *
 接收消息
*
- 聊天室消息的接收与单聊、群聊做了区分,聊天室消息的接收将通过 JMSGConversationDelegate 类里的 onReceiveChatRoomConversation:messages: 方法通知到上层 *
 
Other Methods
+ getChatRoomListWithAppKey:start:count:completionHandler:
	分页获取聊天室详情
+ (void)getChatRoomListWithAppKey:(NSString *JMSG_NULLABLE)appKey start:(NSInteger)start count:(NSInteger)count completionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
appKey | 
						选填,为 nil 则获取当前应用下的聊天室  | 
					
|---|---|
start | 
						分页获取的下标,第一页从 index = 0 开始  | 
					
count | 
						一页的数量,每页最大值是 50  | 
					
handler | 
						结果回调. 正常返回时 resultObject 类型是 NSArray  | 
					
Discussion
该接口总是向服务器端发起请求.
Declared In
JMSGChatRoom.h
+ getMyChatRoomListCompletionHandler:
	获取当前用户已加入的聊天室列表
+ (void)getMyChatRoomListCompletionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
handler | 
						结果回调. 正常返回时 resultObject 类型是 NSArray  | 
					
|---|
Discussion
该接口总是向服务器端发起请求.
Declared In
JMSGChatRoom.h
+ getChatRoomInfosWithRoomIds:completionHandler:
	获取聊天室详情
+ (void)getChatRoomInfosWithRoomIds:(NSArray *JMSG_NONNULL)roomIds completionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
roomIds | 
						待获取详情的聊天室 ID 数组  | 
					
|---|---|
handler | 
						结果回调. 正常返回时 resultObject 类型是 NSArray  | 
					
Discussion
该接口总是向服务器端发起请求.
Declared In
JMSGChatRoom.h
+ enterChatRoomWithRoomId:completionHandler:
	加入聊天室
+ (void)enterChatRoomWithRoomId:(NSString *JMSG_NONNULL)roomId completionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
roomId | 
						聊天室 id  | 
					
|---|---|
handler | 
						结果回调. error = nil 表示加入成功,resultObject 为 JMSGConversation 类型  | 
					
Discussion
成功进入聊天室之后,会将聊天室中最近若干条聊天记录同步下来并以 onReceiveChatRoomConversation: 事件的形式通知到上层,进入聊天室会自动获取最近50条消息。
Declared In
JMSGChatRoom.h
+ leaveChatRoomWithRoomId:completionHandler:
	退出聊天室
+ (void)leaveChatRoomWithRoomId:(NSString *JMSG_NONNULL)roomId completionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
roomId | 
						聊天室 id  | 
					
|---|---|
handler | 
						结果回调. error = nil 表示加入成功.  | 
					
Discussion
退出聊天室后获取不到任何消息和通知.
Declared In
JMSGChatRoom.h
Group basic fields 群组基本属性
  appkey
	聊天室所属应用 AppKey
@property (nonatomic, strong, readonly) NSString *appkeyDeclared In
JMSGChatRoom.h
  totalMemberCount
	聊天室人数
@property (nonatomic, assign, readonly) NSInteger totalMemberCountDeclared In
JMSGChatRoom.h
  maxMemberCount
	聊天室最大人数限制
@property (nonatomic, strong, readonly) NSString *maxMemberCountDeclared In
JMSGChatRoom.h
– getChatRoomOwnerInfo:
	聊天室创建者
- (void)getChatRoomOwnerInfo:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
handler | 
						结果回调. error = nil 表示获取成功, resultObject 为 JMSGUser 类型.  | 
					
|---|
Declared In
JMSGChatRoom.h
– chatRoomBlacklist:
	聊天室的黑名单列表
- (void)chatRoomBlacklist:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
handler | 
						结果回调. resultObject 是 NSArray 类型,元素是 JMSGUser  | 
					
|---|
Availability
3.8.0
Declared In
JMSGChatRoom.h
– addBlacklistWithUsernames:appKey:handler:
	添加黑名单
- (void)addBlacklistWithUsernames:(NSArray<__kindofNSString*> *)usernames appKey:(NSString *JMSG_NULLABLE)appKey handler:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
usernames | 
						用户名列表  | 
					
|---|---|
appKey | 
						用户 appKey,usernames 中的所有用户必须在同一个 AppKey 下,不填则默认为本应用 appKey  | 
					
handler | 
						结果回调。error 为 nil 表示成功.  | 
					
Availability
3.8.0
Declared In
JMSGChatRoom.h
– deleteBlacklistWithUsernames:appKey:handler:
	删除黑名单
- (void)deleteBlacklistWithUsernames:(NSArray<__kindofNSString*> *)usernames appKey:(NSString *JMSG_NULLABLE)appKey handler:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
usernames | 
						用户名列表  | 
					
|---|---|
appKey | 
						用户 appKey,usernames 中的所有用户必须在同一个 AppKey 下,不填则默认为本应用 appKey  | 
					
handler | 
						结果回调。error 为 nil 表示成功.  | 
					
Availability
3.8.0
Declared In
JMSGChatRoom.h
– chatRoomAdminList:
	管理员列表
- (void)chatRoomAdminList:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
handler | 
						结果回调. resultObject 是 NSArray 类型,元素是 JMSGUser  | 
					
|---|
Availability
3.8.0
Discussion
注意:返回列表中不包含房主.
Declared In
JMSGChatRoom.h
– addAdminWithUsernames:appKey:handler:
	添加管理员
- (void)addAdminWithUsernames:(NSArray<__kindofNSString*> *)usernames appKey:(NSString *JMSG_NULLABLE)appkey handler:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
usernames | 
						用户名列表  | 
					
|---|---|
appkey | 
						用户 AppKey,不填则默认为本应用 AppKey  | 
					
handler | 
						结果回调。error 为 nil 表示成功.  | 
					
Availability
3.8.0
Discussion
注意:非 VIP 应用最多设置 15 个管理员,不包括群主本身
Declared In
JMSGChatRoom.h
– deleteAdminWithUsernames:appKey:handler:
	删除管理员
- (void)deleteAdminWithUsernames:(NSArray<__kindofNSString*> *)usernames appKey:(NSString *JMSG_NULLABLE)appkey handler:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
usernames | 
						用户名列表  | 
					
|---|---|
appkey | 
						用户 AppKey,不填则默认为本应用 AppKey  | 
					
handler | 
						结果回调。error 为 nil 表示成功.  | 
					
Availability
3.8.0
Declared In
JMSGChatRoom.h
– addChatRoomSilenceWithTime:usernames:appKey:handler:
	设置成员禁言(可设置禁言时间)
- (void)addChatRoomSilenceWithTime:(SInt64)silenceTime usernames:(NSArray *JMSG_NONNULL)usernames appKey:(NSString *JMSG_NULLABLE)appkey handler:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
silenceTime | 
						禁言时间戳,单位:毫秒,必须不小于5分钟,不大于1年  | 
					
|---|---|
usernames | 
						用户的 username 数组,一次最多500人  | 
					
appkey | 
						用户的 appKey,若传入空则默认使用本应用appKey,同一次设置的 usernames 必须在同一个 AppKey 下  | 
					
handler | 
						结果回调,error = nil 时,表示成功  | 
					
Availability
3.8.1
Discussion
只有房主和管理员可设置;设置成功的话上层会收到相应下发事件。
Declared In
JMSGChatRoom.h
– deleteChatRoomSilenceWithUsernames:appKey:handler:
	取消成员禁言
- (void)deleteChatRoomSilenceWithUsernames:(NSArray *JMSG_NONNULL)usernames appKey:(NSString *JMSG_NULLABLE)appkey handler:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
usernames | 
						用户的 username 数组,一次最多500人  | 
					
|---|---|
appkey | 
						用户的 appKey,若传入空则默认使用本应用appKey,同一次设置的 usernames 必须在同一个 AppKey 下  | 
					
handler | 
						结果回调,error = nil 时,表示成功  | 
					
Availability
3.8.1
Discussion
只有房主和管理员可设置;取消成功的话上层会收到相应下发事件。
Declared In
JMSGChatRoom.h
– getChatRoomMemberSilenceWithUsername:appKey:handler:
	获取禁言状态
- (void)getChatRoomMemberSilenceWithUsername:(NSString *JMSG_NONNULL)username appKey:(NSString *JMSG_NULLABLE)appKey handler:(JMSGCompletionHandler JMSG_NULLABLE)handlerParameters
username | 
						用户名  | 
					
|---|---|
appKey | 
						用户所在应用 AppKey,不填这默认本应用  | 
					
handler | 
						结果回调,resultObject 是 JMSGMemberSilenceInfo 类型 若 error == nil && resultObject != nil,该成员已被禁言 若 error == nil && resultObject == nil,该成员未被禁言 若 error != nil ,请求失败,  | 
					
Availability
3.8.1
Discussion
详细信息可查看 JMSGMemberSilenceInfo 类
Declared In
JMSGChatRoom.h
– getChatRoomSilencesWithStart:count:handler:
	禁言列表
- (void)getChatRoomSilencesWithStart:(SInt64)start count:(SInt64)count handler:(void ( ^ ) ( NSArray<__kindofJMSGMemberSilenceInfo*> *JMSG_NULLABLE list , SInt64 total , NSError *JMSG_NULLABLE error ))handlerParameters
start | 
						开始位置  | 
					
|---|---|
count | 
						需要获取的个数,必须大于 0  | 
					
handler | 
						结果回调  | 
					
Availability
3.8.1
Declared In
JMSGChatRoom.h