Fwd: [jdev] Is there any way to make sure that there will be a response to presence stanza
dave at cridland.net
Fri Apr 20 05:20:10 CDT 2007
On Fri Apr 20 09:42:04 2007, Sergej Andrejev wrote:
> 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?
There's no other sane and sensible way... But...
If, for some reason, you're unable to use non-blocking sockets, the
solution is to ensure that data will be present within a short time
period after you start to poll.
The simplest method for that would be to send an <iq/> before you
poll. You want to send it somewhere that you can reasonably trust to
respond, and you don't want it to harm anything, so I'd opt for a
XEP-0199 to the server.
This is, of course, a major hack, and I'd much recommend avoiding it
if at all possible.
Dave Cridland - mailto:dave at cridland.net - xmpp:dwd at jabber.org
Infotrope Polymer - ACAP, IMAP, ESMTP, and Lemonade
More information about the JDev