Server sent events
When running a long serverside task inside a web application it becomes very useful, if not necessary to report the progress of that task in realtime to the clientside, that is the browser. Earlier there was no easy way to do this and hacks had to be constructed to achieve such a realtime notification. Classical solutions include ajax polling, loading in a iframe with raw output, or even flash. But html5 brings new features to make this easier. And one such feature is server "Server-send Events".
The "Server side events" api allows javascript to generate notifications of events on receiving data from the server. This means that the same connection persists, until it is finished and as the server sends messages, dom events are generated inside the browser so that the browser can handle them. With ajax, the browser cannot do anything till the whole transfer/request finishes. That's the only and the main difference between ajax and server sent events.
At this point you might be wondering about web sockets, a much more spoken about feature of html5 that is capable of bi-directional communication between server and browser. We shall talk about it bit later we shall look into the...
Read full post here
Monitor progress of long running php scripts with html5 server sent events
When running a long serverside task inside a web application it becomes very useful, if not necessary to report the progress of that task in realtime to the clientside, that is the browser. Earlier there was no easy way to do this and hacks had to be constructed to achieve such a realtime notification. Classical solutions include ajax polling, loading in a iframe with raw output, or even flash. But html5 brings new features to make this easier. And one such feature is server "Server-send Events".
The "Server side events" api allows javascript to generate notifications of events on receiving data from the server. This means that the same connection persists, until it is finished and as the server sends messages, dom events are generated inside the browser so that the browser can handle them. With ajax, the browser cannot do anything till the whole transfer/request finishes. That's the only and the main difference between ajax and server sent events.
At this point you might be wondering about web sockets, a much more spoken about feature of html5 that is capable of bi-directional communication between server and browser. We shall talk about it bit later we shall look into the...
Read full post here
Monitor progress of long running php scripts with html5 server sent events