81,092
社区成员
发帖
与我相关
我的任务
分享
try{
XMPPConnection connection = new XMPPConnection("localhost");
connection.connect();
connection.login("liuft", "123123");
ChatManager chatmanager = connection.getChatManager();
newChat = chatmanager.createChat("lft@localhost", new MessageListener() {
@Override
public void processMessage(Chat chat, Message message) {
if (message.getBody()!=null){
System.out.println("Received message: " + message.getBody());
result.put("msg", message.getBody());
}
}
});
}catch(Exception e){
e.printStackTrace();
}
}