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?
thanks,
Sergej
Begin forwarded message:
From: "Norman Rasmussen" <[EMAIL PROTECTED]>
Date: April 20, 2007 11:15:13 AM GMT+03:00
To: "Jabber software development list" <[email protected]>
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 <[email protected]>
On 4/20/07, Sergej Andrejev <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
- Home page: http://norman.rasmussen.co.za/