简体   繁体   English

XMPP聊天室消息

[英]XMPP Room Chat Message

I would execute an example to use OpenFire and XMPP with Java language: 我将执行一个示例,将OpenFire和XMPP与Java语言一起使用:

public class TestXMPP {  

  public static void main(String args[]) throws Exception {  

    ConnectionConfiguration config = new ConnectionConfiguration("127.0.0.1");  
    XMPPConnection xmppConnection = new XMPPConnection(config);  
    try {  
      xmppConnection.connect();  
      xmppConnection.login("serveur22", "serveur22");  
      Message msg = new Message("salon@conference.localhost/serveur22", Message.Type.normal); // Line 10  
      msg.setBody("Test Message TestXMPP.java");  
      xmppConnection.sendPacket(msg);  
      xmppConnection.disconnect();  
    } catch (XMPPException e) {  
      e.printStackTrace();  
    }  
  }  
}  

I can send to a specific login but not for a room... 我可以发送给特定的登录名,但不能发送房间号...

I think line 10 is not correct... 我认为第10行是不正确的...

If you have a solution, thanks a lot 如果您有解决方案,非常感谢

Assuming your XMPP domain is localhost, as you have coded it, try removing the resource from the JID. 假设您的XMPP域是localhost(如已编码),请尝试从JID中删除资源。

Change this: 更改此:

salon@conference.localhost/serveur22 salon@conference.localhost/serveur22

to

salon@conference.localhost salon@conference.localhost

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM