我正在创建一个聊天应用程序,我已经进行了一对一聊天,但无法了解如何创建chatRoom和添加人员。
答案 0 :(得分:0)
我认为此链接会为您提供必要的信息: http://xmpp.org/extensions/xep-0045.html
简单来说,在登录服务器时改变资源允许多个用户加入单个登录,即单个登录可以完成聊天室的工作。
答案 1 :(得分:0)
您可以轻松地为群聊创建群组。 使用以下功能创建组
-(void)joinMultiUserChatRoom:(NSString *)RoomName
XMPPRoomHybridStorage *xmppRoomStorage1 = [XMPPRoomHybridStorage sharedInstance];
XMPPJID *chatRoomJID = [XMPPJID jidWithString:RoomName];
xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:xmppRoomStorage1 jid:chatRoomJID];
[xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
[xmppRoom activate:xmppStream];
NSXMLElement *history = [NSXMLElement elementWithName:@"history"];
[history addAttributeWithName:@"maxstanzas" stringValue:@"1"];
[xmppRoom joinRoomUsingNickname:self.xmppStream.myJID.user history:nil];