Suppose there is a webpage with dynamically generated content -- say a div containing the current number of connected browsers. When the count changes on the server I want a
it is possible to write a java applet which can work as a network server. Once the applet has successfully started, it can report its port and ip number back to the remote server.
Then your server can send messages to the client server any time it feels like. Your java applet can then hand the message off to javascript, or do whatever else.
This method requires java plugin support however, which is far from universal.