繁体   English   中英

XMPP聊天室消息

[英]XMPP Room Chat Message

我将执行一个示例,将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();  
    }  
  }  
}  

我可以发送给特定的登录名,但不能发送房间号...

我认为第10行是不正确的...

如果您有解决方案,非常感谢

假设您的XMPP域是localhost(如已编码),请尝试从JID中删除资源。

更改此:

salon@conference.localhost/serveur22

salon@conference.localhost

暂无
暂无

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

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