JQuery
Ajax
For more responsive communication
In some cases, we don't want the client to poll the server, we would prefer the server push data to the client.
For this we need longer lived connections. There are a few approaches to this on the web...
- Long Polling:
The idea is that the client makes a request to the server and the server keeps the connection open
until it has something to respond. The client immediately processes the responce and then polls again.
The difference here is that the client is not sleeping, instead it is waiting for the server to
respond.
connect 'anything new'
wait for responce
disconnect
process
connect 'anything new'
wait for responce
disconnect
process
connect 'anything new'
wait for responce
disconnect
process
...
Server does not necessarily immediately respond.
Comet Programming (especially Long Polling)
Push Technology (Long Polling)
- Server sent events:
at html5rocks
at w3
at w3schools
- WebSockets