iOS XMPP group chat implementation

那年仲夏 提交于 2019-12-04 13:42:00

问题


I am trying to create chat room using robbiehanson XMPPframework.

Since I didn't get any sample code or documentation, I made a try by myself to initiate a chat room as follows:

    XMPPRoomMemoryStorage *rosterstorage = [[XMPPRoomMemoryStorage alloc] init];
    XMPPRoom *xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:rosterstorage jid:[XMPPJID jidWithString:@"test@mycompany.com/room"] dispatchQueue:dispatch_get_main_queue()];    
    [xmppRoom configureRoomUsingOptions:nil];
    [xmppRoom activate:[UIAppDelegate xmppStream]];
    [xmppRoom addDelegate:UIAppDelegate
            delegateQueue:dispatch_get_main_queue()];
   [xmppRoom inviteUser:[XMPPJID jidWithString:jabberID] withMessage:@"Hi join room"];

But I am getting the response in the console as :

 RECV: <message xmlns="jabber:client" from="test@mycompany.com" to="user1@mycompany.com/42512304551337785705750233" type="error"><x xmlns="http://jabber.org/protocol/muc#user"><invite to="user2@mycompany.com"><reason>Hi join room</reason></invite></x><error code="503" type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></message>

Anybody have any idea to initiate MUC??Is there any sample code for this??Any help will be appreciated..Thanks in advance..


回答1:


Finally I figured it out. It may help someone. While creating or joining the room, the format should be yourRoomName@conference.YourDomainName.com. 'conference' is the keyword here.




回答2:


Each room is identified as a "room JID" (e.g., ), where "room" is the name of the MUC room and "service" is the hostname at which the multi-user chat service is running. Reference XEP-0045

The keyword "conference" is mandatory to use in order to start group chat using XMPP Client.




回答3:


As far as I know, MUC is not possible with the facebook XMPP server, because it's a stripped down one. They don't say it explicitly, but I found some hints in the pidgin wiki (it's german): http://wiki.pidgin-im.de/index.php/Facebook. I've been struggling with this topic as well...



来源:https://stackoverflow.com/questions/10723368/ios-xmpp-group-chat-implementation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!