Receive input over TCP / IP and use it to update HTML

This should be an FAQ, so someone can just direct me to a network programming url for dummies?

The server wants to send information to the client or broadcast to everyone when an event occurs - unlike clients who constantly poll the server "just in case." The client then refreshes the display of the browser page.

How can I do it? (said it was n00b question)

Do I have to have a stream that receives socket information and then writes it to a database that the browser can display (PHP), process with an HTML refresh tag, or what?

Sorry that sounds so silly.

+2


a source to share


4 answers


I think you can search for something like comet: http://en.wikipedia.org/wiki/Comet_%28programming%29

Comet is kind of the opposite of polling where you have a long-standing HTTP connection that allows you to send data to the client from the server. Unfortunately, I don't have many options other than the link like above, but hopefully it gets you started in the right direction.

A few more links that might be helpful:



fooobar.com/questions/tagged / ...

http://ajaxpatterns.org/HTTP_Streaming

+2


a source


Sorry folks, the obvious answer is http://en.wikipedia.org/wiki/Push_technology#HTTP_server_push



+2


a source


Perhaps the obvious answer in the previous post can solve the "problem". Another way is to automatically force the browser to refresh the page. The server can then provide information that can be used by the browser. Use a meta tag with updated attributes and content

+1


a source


There are several ways to hide this bow: 1.fragments with a 2.ajax timer. 3.comet - server load 3.etc.

and don't forget that latex html5-websockets - maybe even IE9: http://ezinearticles.com/?HTML5-Web-Sockets-Example&id=4239499

+1


a source







All Articles