【问题标题】:Create Group Chat using XMPP使用 XMPP 创建群聊
【发布时间】:2015-01-15 05:59:21
【问题描述】:

我正在创建一个聊天应用程序,我已经进行了一对一聊天,但无法了解如何创建聊天室和添加人员。

【问题讨论】:

标签: xmpp xmppframework


【解决方案1】:

我想这个链接会给你打电话的必要信息: http://xmpp.org/extensions/xep-0045.html.

简单来说,在登录服务器时改变资源允许多个用户隶属于单个登录,即单个登录完成聊天室的工作。

【讨论】:

    【解决方案2】:

    您可以轻松创建群组进行群聊。 使用以下函数创建组

    -(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];
    

    【讨论】:

      猜你喜欢
      • 2013-09-24
      • 2017-07-13
      • 2016-02-29
      • 2011-02-19
      • 1970-01-01
      • 2012-05-30
      • 1970-01-01
      • 2014-02-10
      • 1970-01-01
      相关资源
      最近更新 更多