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

Sergej Andrejev sandrejev at gmail.com
Fri Apr 20 03:42:04 CDT 2007

No, the problem is as follows. I want to get all my available  
contacts. To do so I send <presence /> stanza. The problem is that  
the script will hang here because there will be no reply from server  
if there are no users sharing there presence with me. In a few words  
I send a presence stanza and waiting for a reply which will never  
arrive because there are no contacts. As far as I understand PHP  
doesn't not support non-blocking SSL streams.
Is there a way that my presence will always return something or do I  
have to write everything in events and there is no other way?


Begin forwarded message:

> From: "Norman Rasmussen" <norman at rasmussen.co.za>
> Date: April 20, 2007 11:15:13 AM GMT+03:00
> To: "Jabber software development list" <jdev at jabber.org>
> Subject: Re: [jdev] Is there any way to make sure that there will  
> be a response to presence stanza
> Reply-To: Jabber software development list <jdev at jabber.org>
> 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/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.jabber.org/pipermail/jdev/attachments/20070420/410fe8a6/attachment-0002.htm>

More information about the JDev mailing list