[jdev] Is there any way to make sure that there will be a response to presence stanza

Norman Rasmussen norman at rasmussen.co.za
Fri Apr 20 03:15:13 CDT 2007


On 4/20/07, Sergej Andrejev <sandrejev at gmail.com> wrote:
> I'm writing a PHP jabber/xmpp library. So far I can connect and do
> basic actions, but there is one problem. PHP cannot use unblocking
> stream when working with SSL. That means when I am sending stanza I
> must decide whether to wait for a response or not. For example when
> sending a <message /> I am not waiting for response, but when sending
> <iq /> I do. Now when sending <presence /> I am not really sure about
> the response and whether it will arrive or not. So if it arrives
> everything is fine, but when not my script just hangs there waiting
> for response. So what I am asking is that is there any type of
> <presence /> which will 100% return some data (and contacts, if there
> are some)

The 'standard' way of writing xmpp apps, is there's normally a central
loop somewhere that does the blocking receive and then the stanza is
dispatched to a set of event handlers.  Most frameworks offer the
ability to send a stanza and ask for your callback function to be
executed when you receive a reply with the same id.  (The 'pending'
call goes into a list which is check when incoming stanzas are
received, if the id's match then the callback method is executed)

-- 
- Norman Rasmussen
 - Email: norman at rasmussen.co.za
 - Home page: http://norman.rasmussen.co.za/



More information about the JDev mailing list