I’m in the process of converting a web application from an Apache + PHP backend to Node.js. The application being converted is based heavily around real time interaction between users, so, it was a natural fit for WebSockets.
In fact the old application used a Node.js backend for WebSockets, but an Apache + PHP backend for everything else, including page generation and AJAX endpoints. This means every AJAX driven form had a PHP endpoint which performed a desired action and a WebSocket event listener waiting to broadcast the event to other users.
Having to recode this application from the ground up in a new asynchronous language presented an interesting question to me.
Why should I use AJAX when I have WebSockets?