
- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
Using HTML5 Server-Sent Events in a web application
To use Server-Sent Events in a web application, you would need to add an <eventsource> element to the document.
The src attribute of the <eventsource> element should point to an URL that should provide a persistent HTTP connection that sends a data stream containing the events.
The URL would point to a PHP, PERL or any Python script that would take care of sending event data consistently.
Example
Here is an example showing application that would expect server time.
<!DOCTYPE HTML> <html> <head> <script> /* 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>
- Related Articles
- HTML5 Server-Sent Events working
- How Server-Sent Events Works in HTML5?
- How can I handle Server-Sent Events in HTML5?
- Is there a Microsoft equivalent for HTML5 Server-Sent Events?
- Difference between Web Server and Application Server
- What are Long-Polling, Websockets, Server- Sent Events (SSE) and Comet?
- Use of Ionic as desktop web application with HTML5
- Web Scraping in Android Application using Kotlin?
- How to handle HTML5 media events using jQuery?
- Monitors linux server performance remotely using web browser
- Difference between Web Browser and Web Server.
- Web scrapping in Android application
- Stop Web Workers in HTML5
- Web Application Testing Checklist
- Web Application Testing Guide

Advertisements