[wp-hackers] WordPress and Websockets

Braydon ronin at braydon.com
Thu Sep 22 19:14:14 UTC 2011

On 09/22/2011 11:54 AM, Dougal Campbell wrote:
> On Sep 20 2011 5:21 PM, Eric Mann wrote:
>> I'm working on a plugin that, ideally, would make use of websockets to
>> communicate between the front-end and the WordPress backend.  Basically,
>> whenever a post is published on the backend, it should trigger an 
>> event on
>> the front-end for other users.  This can be done using old school 
>> AJAX and
>> long polling, but the point is more to make use of the cutting-edge
>> technology than to fall back on "what works."
> Have you looked at how the P2 theme does its dynamic front-page 
> updates when new posts and comments are posted? You might be able to 
> borrow code from there without too much fuss.
I've worked on several themes using P2, and it uses a polling method 
every minute using a timestamp to see if anything new in a timespan. If 
there are any new posts or comments, it then appends them into the page 
based off that response. So it isn't anywhere near something could be 
used for real-time interaction. When doing modifications to the theme 
it's very easy to break these behaviors by changing the markup because 
of the separation between the HTML generated from PHP and HTML generated 
from JavaScript. It becomes a headache to make sure each works with each 

More information about the wp-hackers mailing list