[wp-hackers] WordPress and Websockets

Daniel Fenn danielx386 at gmail.com
Wed Sep 21 08:32:33 UTC 2011

3: may not work when wordpress is used on an internal website where
external traffic is blocked. 4: security

On 21/09/2011, Peter Westwood <peter.westwood at ftwr.co.uk> wrote:
> Hi Eric,
> On 20 Sep 2011, at 22:21, 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."
>> Unfortunately, most users are running WordPress on an Apache server ...
>> and
>> Apache doesn't natively support websockets.  There are some modules you
>> can
>> add to make it work, but that's not an option for people running WP on a
>> shared host.
>> One option I have is to use Apache anyway.  It can be forced to work with
>> websockets using a few PHP scripts I found, but once the websocket is open
>> you essentially steal a persistent connection to Apache (which is itself a
>> blocking process).  So while this would work, and would probably work well
>> for low-traffic sites, it could easily lock up an ill-configured server or
>> crash someones system.
>> Another option is to host the websocket part of the system on my server
>> (where I can use Nginix, Node.js, or any other websocket-friendly server)
>> and have the plugin interface with my server.  The downside here is that
>> my
>> system then becomes the bottleneck ...
>> My question to you: which option would you take?  Try to make due with
>> installed software, or move the mission-critical part of the application
>> to
>> your own box?  Does anyone have experience implementing websockets in
>> WordPress already?  Is there something I'm missing?
> Based on the level of available support you describe above I wouldn't use
> websockets unless I was writing the plugin as custom development for a site
> where I knew that they could work well because the web server was going to
> support them.
> I don't think having all the traffic run via a server you host is good for a
> number of reasons:
> 1) It isn't going to scale
> 2) It means sending all the content back to your server.
> Cheers
> --
> Peter Westwood
> http://blog.ftwr.co.uk | http://westi.wordpress.com
> 50BF A954 E072 23DB B50A  A319 56C3 8FFF 9C72 AB79
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

Daniel Fenn

More information about the wp-hackers mailing list