如何一次性向所有用户部署实时JavaScript

Basically I need to parse JavaScript to a live server to everyuser who is currently logged in at the sametime. [For live notifications and other valuations]

I have already tried

php while(loop)...... @ this point i didn't close or terminate or break the while loop at the end but rather setinterval in javascript to keep posting synchronous requests

It actually worked but I realized the the infinite loop performs over 10000 requests to my server in just30 minutes and also freezes the client's interface.

How can I achieve that... Thanks n advance