In openfire I have registred 2 user : user1 and user2
When the users connect to openfire , in the server the users are online.
The proble is this :
When I create a chat beetwen the users ,but the 2 users don’t receive any messages.
My code :
//Create a connection with the Server and login , this part it's ok !!!!!!
ConnectionConfiguration connConfig =
new ConnectionConfiguration("192.168.1.3", "5222", "user1.local");
XMPPConnection connection = new XMPPConnection(connConfig); try {
connection.connect();
} catch (XMPPException ex) {
xmppClient.setConnection(null);
}
try {
connection.login(username, password);
// Set the status to available
Presence presence = new Presence(Presence.Type.available);
connection.sendPacket(presence);
xmppClient.setConnection(connection);
} catch (XMPPException ex) {
xmppClient.setConnection(null);
} //Craete a chat beetwen user1 and user2 ;I Don't receive any messages !!!! ChatManager chatmanager = connection.getChatManager();
Chat newChat = chatmanager.createChat("user2", new MessageListener() {
public void processMessage(Chat chat, Message message) {
System.out.println("Received message: " + message.getBody());
}
});
try {
newChat.sendMessage("Hello");
}
catch (XMPPException e) {}
Thanks for the support !!!