powered by Jive Software

How to see everything a server (Facebook) is responding?

Hey I am a smack beginner! how can i display every response from the xmpp server?

I try to send messages but a lot of them get lost on the way so i want to check the response of the server. I am using smack 3.3.1 sending to the facebook xmpp port.

DeliveryReceiptManager and/or MessageEventManager wont show anything so i would like to see everything the server is responding!

What response can i expect from the facebook xmpp port? Their doc is very poor!

`connection.login(apiKey, accessToken);
try {
DeliveryReceiptManager deliveryReceiptManager = DeliveryReceiptManager.getInstanceFor(connection);
deliveryReceiptManager.addReceiptReceivedListener(new ReceiptReceivedListener() {
@Override
public void onReceiptReceived(String s, String s2, String s3) {
System.out.println(“REVEIVED RESPONCE”);
System.out.println(s);
System.out.println(s2);
System.out.println(s3);
}
});
Chat chat = connection.getChatManager().createChat("100007499312629@chat.facebook.com", new MessageListener() {
@Override
public void processMessage(Chat chat, Message message) {
if(message.getType() == Message.Type.chat)
System.out.println(chat.getParticipant() + " says: " + message.getBody());
}
});
Message msg = new Message();
msg.setSubject(“Invite”);
msg.setBody(“blablabla”, "1234567890@chat.facebook.com");
DeliveryReceiptManager.addDeliveryReceiptRequest(msg);
//MessageEventManager.addNotificationsRequests(msg, true, true, true, true);

        chat.sendMessage(msg);
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }catch (XMPPException e){
        e.printStackTrace();
    }`

XEP-0184: Message Delivery Receipts which are referring to here, is a client-to-client protocol.

So it only works, if the recipient sends a receipt (and you requested a receipt).

I think what you would actually need is XEP-0198: Stream Management , but that protocol is not supported by Facebook server (nor by Smack).

Thanks for your answer!

Is there any way to check if a message has been delivered?

How can i just print the resonse the server returns?

If anything, you could only try it with DeliveryReceiptManager.

But I am not sure, if the normal Facebook client (i.e. the Web Interface) supports receipts.

The server does not return anything. It’s the client which would return a “receipt” message (if supported).

If you read http://xmpp.org/extensions/xep-0184.html#what

you are warned, that you can’t rely on receipts.

Thanks for your answer but the callback of the DeliveryReceiptManager wont get called.

The message get translatet into Facebooks internal messaging system and xmpp is only a port for sending messages there. So i would guess that the translation client interface is so poorly implementet like the rest of Facebook. Too bad.

Yes, that is what I have suspected.