Set timeout when sending a message and questions about delegate methods

127 views
Skip to first unread message

Peter Warbo

unread,
May 4, 2013, 4:50:58 PM5/4/13
to xmppfr...@googlegroups.com
Is there a way to set a timeout when sending an XMPP message (if user is on a slow connection)?

Also I'm curious about the delegate methods:

For instance:

 - (void)xmppStream:(XMPPStream *)sender didSendMessage:(XMPPMessage *)message

This delegate method is called when the message is sent? But does that mean that the message has reached the destination? A little extra explanation here would be great :)

- (void)xmppStream:(XMPPStream *)sender didReceiveError:(NSXMLElement *)error

When is this delegate method likely to happen? Does it happen when sending messages? Or receiving messages? Or both? What could the errors be?

ObjColumnist

unread,
May 4, 2013, 5:37:39 PM5/4/13
to xmppfr...@googlegroups.com
In short, there is no way of knowing if a message has reached the server, it isn't part of the protocol.

 - (void)xmppStream:(XMPPStream *)sender didSendMessage:(XMPPMessage *)message

This tells you that the Message has been written to the socket

- (void)xmppStream:(XMPPStream *)sender didReceiveError:(NSXMLElement *)error


Normally this method will only get called if you send invalid data to the XMPP Server e.g. malformed XML


Regards

Spencer

Peter Warbo

unread,
May 4, 2013, 7:06:47 PM5/4/13
to xmppfr...@googlegroups.com
Thanks for your reply.

I'm not too familiar with sockets (I just remember installing Trumpet Winsock on Windows 95). So that when the message is placed on the socket it has not even begun to transfer the message over the network?

ObjColumnist

unread,
May 5, 2013, 5:15:59 AM5/5/13
to xmppfr...@googlegroups.com
Yeah, the socket has a buffer that you write to on one end, the OS deals with the other end and sends the data over the network.

The greater issue is that XMPP Servers don't send delivery receipts, although clients can request delivery receipts from other clients.

Even with this approach, it is hard to know where things went wrong as the flow isn't very short:

Client A => Server => Client B => Server => Client A

Reply all
Reply to author
Forward
0 new messages