Ahh - a stateful server daemon to maintain a stateful session on behalf of a non-stateful client - and herein lies the problem.<br><br>Sounds like a job for one of the Jabber c libraries - I&#39;m sure google accomplishes this through Python (which gmail is written in) or a compiled language.<br>
<br>Here&#39;s some code to get you started ... (borrowed from apache)<br><br>for ( ; ; ) {<br>  // your session code<br>}<br><br>Although I don&#39;t agree PHP is a wasteland - PHP as an SAPI (which is what you are referring to) wasn&#39;t designed to have it&#39;s execution piped to waiting or stateless threads from user requests through DMA unfortunately - However the PHP thread is capable of leaving open &#39;persistant&#39; connections<br>
<br>pfsockopen();<br><br>I&#39;m not an expert on the XMPP / Jabber protocols but  I&#39;ve implemented other persistent connections (such as terminal emulation) across requests using persistent sockets... I have to guess that&#39;s how xmpphp is implemented (it would hopefully not suffer the log out, log in) issues you are describing across requests.<br>
You&#39;ve actually spiked my curiousity so I&#39;m going to look into the protocol more, as implementing a decent chat client is something I&#39;ve always wanted to do but just haven&#39;t really had a need.<br><br>A completely different approach is to open a PHP thread for each jabber login request received - then ignore user abort, and have the thread query a database on a regular basis to determine if the connection should be closed based on timeout / user abort.  <br>
The never ending thread would persist for each user, and it may be smart to set the maximum memory size to something pretty small so if there are hundreds of simultaneous users PHP doesn&#39;t reserve all the systems memory across all of the possible threads.<br>
You might even be able to consolidate ALL users to one never ending thread on the server and just conditionally open and close as many different sockets as needed based on queries to a database.<br><br>Yet another and probably more elegant solution is to perform interprocess communication to a persistent php thread using sockets and the socket_create_pair() function.<br>
<br>So when PHP get&#39;s namespaces and lambda functions in 6.0 will it be promoted to an oasis? Oh I can&#39;t wait to be Y combinating in my wasteland.<br><br>The real issue is that almost all PHP opensource applications have the goal of reaching the largest audience - with that goal comes the requirement to run on shared hosts, and with that comes the lack of applications that interact with or are concerned with persistent services such as XMPP; thus the wasteland.<br>
<br>But I digress... <br><br><div class="gmail_quote">On Wed, May 27, 2009 at 5:06 PM, Ben Rousch <span dir="ltr">&lt;<a href="mailto:brousch@gmail.com">brousch@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I have done some (very) small experiments on something similar to what you&#39;re asking for. I did not really look for any sort of robust middleware.<br><br>I used the Jive/OpenFire/Ignite Realtime (Whatever their name is these days) Smack Java library to create a xmpp client/bot. A user would chat with my xmpp bot, and the bot would process their commands and store the results in a database. I then used LAMP and AJAX to poll the database and post on a web site.<br>

<br>_______________________________________________<br>
grlug mailing list<br>
<a href="mailto:grlug@grlug.org">grlug@grlug.org</a><br>
<a href="http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug" target="_blank">http://shinobu.grlug.org/cgi-bin/mailman/listinfo/grlug</a><br></blockquote></div><br>