1.

What are the server-sent events in HTML5?

Answer»

The events pushed from the webserver to the BROWSERS are called server-sent events. DOM elements can be continuously updated using these events. This has a major advantage over straight-up polling. In polling, there is a LOT of overhead since every time it is ESTABLISHING an HTTP connection and tearing it down whereas, in server-sent events, there is one long-lived HTTP connection. To use a server-sent EVENT, <eventsource> element is used. The src attribute of this element specifies the URL from which sends a data stream having the events.

<eventsource src = "/cgi-bin/myfile.cgi" />


Discussion

No Comment Found