I am developing chat application using XMPPFramework
How can i receive history of messages after join existing room?
Now i join to room like this:
XMPPJID *roomJid = [XMPPJID jidWithString:[NSString stringWithFormat:@"%@@conference.%@",systemName,xmppServer]];
xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:[XMPPRoomHybridStorage sharedInstance] jid:roomJid];
[xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
[xmppRoom activate:xmppStream];
NSXMLElement *history = [NSXMLElement elementWithName:@"history"];
[history addAttributeWithName:@"maxstanzas" stringValue:@"100"];
[xmppRoom joinRoomUsingNickname:user.deviceUUID history:history];
Also i read example from documentation
According to this example I also tried to join room this way:
XMPPJID *roomJid = [XMPPJID jidWithString:[NSString stringWithFormat:@"%@@conference.%@",systemName,xmppServer]];
xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:[XMPPRoomHybridStorage sharedInstance] jid:roomJid];
[xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
[xmppRoom activate:xmppStream];
NSXMLElement *presence = [NSXMLElement elementWithName:@"presence"];
[presence addAttributeWithName:@"from" stringValue:[NSString stringWithFormat:@"bob@%@",xmppServer]];
[presence addAttributeWithName:@"to" stringValue:[NSString stringWithFormat:@"%@@conference.%@/%@",systemName,xmppServer,user.deviceUUID]];
NSXMLElement *x = [NSXMLElement elementWithName:@"x" xmlns:@"http://jabber.org/protocol/muc"];
NSXMLElement *history = [NSXMLElement elementWithName:@"history"];
[history addAttributeWithName:@"maxstanzas" stringValue:@"100"];
[x addChild:history];
[presence addChild:x];
[xmppRoom joinRoomUsingNickname:user.deviceUUID history:presence];
I join room successfully, but don't receive history of previous messages.
Btw, if at least one user in the room, i receive all previous messages, even if i join room like:
[xmppRoom joinRoomUsingNickname:user.deviceUUID history:nil];
If all users leave room and then some join again - history is empty=(
What am I doing wrong? Do i need to turn on some settings on the server side to save history (eg, logging)?
And some questions about example from documentation:
What means "from" parameter? Does it mean that I ask for the history of messages in this room only from user bob? And what if i want to receive all history (messages from any users)?
What means "id" parameter? I didn't find any description in the documentation.