Are there any client libraries developed for ejabberd? I am looking for Java client library. Thanks.
To access the most up-to-date ejabberd documentation, please visit docs.ejabberd.im »
Are there any client libraries developed for ejabberd? I am looking for Java client library. Thanks.
You want to write a
You want to write a XMPP/Jabber client in Java. You can use any XMPP/Jabber library written in Java, no need to be ejabberd specific.
Seehttp://en.wikipedia.org/wiki/List_of_XMPP_library_software#Java
Hi badlop, Thank you very
Hi badlop, Thank you very much! Smack seems to be good.
use Smack connect to Ejabberd error
Hi, I have tested Smack with Ejabberd these days, but i failed.
When i login, i get authentication error.
Have you solve your problem?
Here is my code:
XMPPConnection connection = new XMPPConnection("xxx");
try{
connection.connect();
connection.login("t", "t");
connection.addPacketListener(new PacketListener(){
@Override
public void processPacket(Packet packet) {
System.out.println(packet.getFrom());
for (String propertyName : packet.getPropertyNames()) {
System.out.println(propertyName+" => "+packet.getProperty(propertyName));
};
}
}, new PacketFilter(){
@Override
public boolean accept(Packet arg0) {
return true;
}
});
BufferedReader bReader=new BufferedReader(new InputStreamReader(System.in));
String tmpString;
System.out.println("now you can input:");
while (!(tmpString=bReader.readLine()).equals("quit")) {
Message mes=new Message();
mes.setProperty("1", "hello");
mes.setProperty("2", "hello");
mes.setSubject("d");
mes.setTo("t2@shujie-desktop");
connection.sendPacket(mes);
}
}catch(Exception e){
e.printStackTrace();
}finally{
connection.disconnect();
}