powered by Jive Software

I want to listen for message!

hi guys i’ve made a facebook chat app.i can chat with anybody i wish.but wheneva someone knocks me i neva know this! that means when i want to chat with a people i create a chat manager & listener to send & recieve msgs from him.that works fine!but if anyone knocks me from there,i m not getting him! how can i solve this?please anyone answer me!

Aparently we have a similar problem. See my case

here no one responses easily…whats wrong with this forum!~

Hi Md.Abdul Munim Dibosh

wer u able to connect to facebook chat server?? I am using smack 3.1.0 with digest md5 as authentication method. i get an error tellin SASL authentication failed…below is the code

SASLAuthentication.registerSASLMechanism(“DIGEST-MD5”, SASLDigestMD5Mechanism.class);

SASLAuthentication.supportSASLMechanism(“DIGEST-MD5”, 0);

ConnectionConfiguration config = new ConnectionConfiguration(“chat.facebook.com”,5222,“chat.facebook.com”);

connection = new XMPPConnection(config);

config.setSASLAuthenticationEnabled(true);

connection.connect();

connection.login(userName, password);

System.out.println(connection.isAuthenticated());

could u pls point out wats wrong??? its urgent plsssss

facebook doesnt use plain DIGEST-MD5, they use their own custom digest-md5 with some additional info

according to the facebook chat documentation they use digest md 5 or their own authentication called X facebook platform… i think u r talking abot X facebook platform authentication

something like this should do it

// register listeners so people can start a chat with us (without this we have to start it)

ChatManager chatmanager = connection.getChatManager();

connection.getChatManager().addChatListener(new ChatManagerListener()

{

public void chatCreated(final Chat chat, final boolean createdLocally)

{

chat.addMessageListener(new MessageListener()

{

public void processMessage(Chat chat, Message message)

{

System.out.println("Received message: "

  • (message != null ? message.getBody() : “NULL”));

me.processMessage(chat,message);

}

});

}

});