it's called comet, and last time i checked, was a bit complicated.
there is no single, standardized way to do this. it's the wild west.
Comet requires both front and back end code, and different techniques work better in different browsers.
i recommend a script tag trigger and an AJAX data pipe.
you can send stuff to and request stuff from the server whenever you want, so all you really need to do is know when to do so, which requires a 2nd connection.
when something happens on that 2nd connection, you re-use the first connection to actually fetch the data, and optionally upload more. the 2nd connection should be used only to trigger.
if you try to push data through your 2nd connection, you will find a lot of cross-browser headaches.
(2013/5) HTML5:90.2% MOB:15.2% IE7:0.5% IE8:8.4% IE9:8.5% IE10:8.5%