簡體   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