Question: I know that I'll receive the last 50 messages in the room history. But how to know how many messages I will receive if the chat room history has less than 50 messages?

Answer: 
After join room

```
[[QBChat instance] joinRoom:testRoom];

```

you will receive all messages in delegate and count this way

```
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 provide a separate request to get a number of chat messages for particular dialog:  
Like in javascript : 

```
var params = {chat_dialog_id: dialogId, count: 1};
QB.chat.message.list(params, function(err, messagesCount) {
  if (messagesCount) {

  }else{
    console.log(err);
  }
});

```