XMPPFramework - How to create a group chat room?

后端 未结 2 1188
隐瞒了意图╮
隐瞒了意图╮ 2021-01-06 16:24

I have an application which I am using for one-to-one chat. Now I need to implement group chat. I know it is possible with XMPPFramework and there is a class called XMPPRoom

相关标签:
2条回答
  • 2021-01-06 16:46

    here you have a script that allows to connect to a room

    [xmppRoom activate:[self xmppStream]]; 
    [xmppRoom createOrJoinRoom];
    

    In order to do this you should have access to the xmppStream.

    0 讨论(0)
  • 2021-01-06 16:49
    - (void)createOrJoinRoomWithRoomName:(NSString *)roomName nickName:(NSString *)nickName 
        {
            if(roomName && nickName)
            {
                _xmppRoomStorage = [XMPPRoomHybridStorage sharedInstance];
                XMPPJID *roomJid = [XMPPJID jidWithString:[NSString stringWithFormat:@"%@@%@.%@",roomName,@"conference",self.hostName]];
                _xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:_xmppRoomStorage jid:roomJid];
                [_xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
                [_xmppRoom activate:_xmppStream];
                NSXMLElement *history = [NSXMLElement elementWithName:@"history"];
                [history addAttributeWithName:@"maxstanzas" stringValue:MAX_ROOM_HISTORY];
                [_xmppRoom joinRoomUsingNickname:nickName history:history];
            }
            else
            {
                NSLog(@"room creation arguments missing");
            }
        }
    
    0 讨论(0)
提交回复
热议问题