I feel u are choosing the wrong language for this purpose (PHP), there may be a way out to do it in PHP , but i am damp sure that its would be a twisted one. I recommend using node.js for this purpose as using it you can accomplish pushing notifications to client in much simpler way
Server Side
var app = require('http').createServer(handler)
, io = require('socket.io').listen(app)
, url = require('url')
app.listen(8080);
function handler (req, res) {
// parse URL
var requestURL = url.parse(req.url, true);
// if there is a message, send it
if(requestURL.query.message)
sendMessage(decodeURI(requestURL.query.message));
// end the response
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end("");
}
function sendMessage(message) {
io.sockets.emit('notification', {'message': message});
}
Client Side
<script src="socket.io.min.js"></script>
<script>
var socket = io.connect('http://localhost:8080');
socket.on('notification', function (data) {
console.log(data.message);
});
</script>
So you see its lot eassy if you use the suitable language for it