在用用户'username@localhost‘连接到openfire服务器后,我正在尝试创建一个组聊天即时室,因此,首先我按照这里指定的方式发送存在节:
<presence from='username@localhost' to='testroom@conference.localhost' xmlns='jabber:client'>
<x xmlns='http://jabber.org/protocol/muc'></x>
</presence>但是,响应总是一个错误:
<presence ... from='testroom@conference.localhost type='error'>
<x xmlns='http://jabber.org/protocol/muc></x>
<error code='400' type='modify'>
<bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanza"></bad-request>
</error>
</presence>是否有任何配置,我必须做的Openfire,以使这一工作?我知道你可以用Openfire Gui创建一个群聊天室,这很好,但是当我尝试加入那个聊天室时,我会得到同样的错误。
发布于 2013-09-20 17:19:27
你需要在房间里指定你想要的昵称。这是您发送到的JID的资源。
例如,要以“Joe”的身份加入这个房间,请将您的存在节发送到testroom@conference.localhost/Joe,而不是只发送testroom@conference.localhost。
您的join节也不应该包含“from”属性,这是added for you by the server。包括一个没有破坏任何东西,但它是没有意义的(而且你的错无论如何,它一定是一个完整的JID)。
因此,作为“乔”加入会议室的一节是正确的:
<presence to='testroom@conference.localhost/Joe' xmlns='jabber:client'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>有关详细信息,请参阅XEP-0045: Entering a room。
https://stackoverflow.com/questions/18902430
复制相似问题