简体   繁体   中英

XMPP Room Chat Message

I would execute an example to use OpenFire and XMPP with Java language:

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...

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.

Change this:

salon@conference.localhost/serveur22

to

salon@conference.localhost

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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