我正在尝试使用 robbiehanson XMPPframework 创建聊天室。
由于没有得到任何示例代码和文档,我自己尝试发起一个聊天室如下:
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"];
但我在控制台中得到的响应是:
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>
有人知道启动 MUC 吗?有这方面的示例代码吗?如有任何帮助,我们将不胜感激。提前致谢。
最佳答案
我终于明白了。它可能会帮助某人。创建或加入房间时,格式应为 yourRoomName@conference.YourDomainName.com。 “ session ” 是此处的关键字。
关于iphone - iOS XMPP群聊实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10723368/