What is web application in HTML5

In this article I have describe about Web application Events.
  • 1775

What is HTML5 Server-Sent Events

  • When a web page updates automatically from a server, it is a server-sent event.
  • The web page would have to ask if any updates were available in server-sent events.
  • The SSE servers can start data transmission for client, and send a message update.
  • Facebook/Twitter updates, stock price updates, news feeds, sport results, etc.

Web Application for SSE

  • Server sent event is a web application, and add an <eventssource> element to the document.
  • The <eventssources> elements should point to an URL in src attribute, and provide a HTTP connection that sends a data stream containing the events.
  • The URL would point to a PHP, PERL or any Python script of sending event data consistently.
  • Web application expect server time in this example.

Example

<!DOCTYPE HTML>

<html>

<head>

<script type="text/javascript">

    /* Define event handling logic here */

</script>

</head>

<body>

<div id="sse">

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

</div>

<div id="ticker">

   <TIME>

</div>

</body>

</html>

Define the code

  • We create a new object in Event Source, then URL page sending the updates.
  • Message event receive update for each time.
  • Message put data into the element id="Sse".

Further Readings

You may also want to read these related articles :

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2019 DotNetHeaven. All rights reserved.