1
我知道我会收到房间历史记录中的最后50封邮件。但是,如果聊天室历史记录少于50条消息,如何知道我将收到多少条消息?Quickblox聊天室中有多少条消息?
我知道我会收到房间历史记录中的最后50封邮件。但是,如果聊天室历史记录少于50条消息,如何知道我将收到多少条消息?Quickblox聊天室中有多少条消息?
后加入房间
[[QBChat instance] joinRoom:testRoom];
您将收到的所有邮件中的委托和计数这样
static int count = 0;
- (void)chatRoomDidReceiveMessage:(QBChatMessage *)message fromRoom:(NSString *)roomName{
NSLog(@"Did receive message: %@, from room %@", message, roomName);
++count;
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(receivedAllMessages) object:nil];
[self performSelector:@selector(receivedAllMessages) withObject:nil afterDelay:1.0];
}
- (void)receivedAllMessages{
NSLog(@"%d", count);
}
Quickblox提供一个单独的请求得到了一些特定对话的聊天消息:
像in javascript:
var params = {chat_dialog_id: dialogId, count: 1};
QB.chat.message.list(params, function(err, messagesCount) {
if (messagesCount) {
}else{
console.log(err);
}
});