Get Latest Updated Data using SSE(Server-Sent-Events) Automatically

hii guys,

This is very interesting topic which i gonna share with you people.  So many times i think about how facebook/Twitter updates, stock price updates, news feeds, sport results are working?

finally i found easy and simple way to do same thing. so i just developed simple application which demonstrate usage of SSE (Sever-Sent-Events).

so i developed Latest Job Post Application, which give you latest job posted by any employee on webpage automatically.

let’s go for coding

index.html

index.php_SSE

so here i’m using SSE and in EventSource i’m passing viewpost.php file, which fetch latest record from table.

viewpost.php

viewpost.php_SSE

As a output in {topjob} div, always latest job will be printed without refreshing page.

About SSE:

A server-sent event is when a web page automatically gets updates from a server.

This was also possible before, but the web page would have to ask if any updates were available. With server-sent events, the updates come automatically.

Examples: Facebook/Twitter updates, stock price updates, news feeds, sport results, etc.

Disadvantage:

IE does not support it .. 😦

Done!

Hope you gonna like Dis. .. 🙂

6 thoughts on “Get Latest Updated Data using SSE(Server-Sent-Events) Automatically

  1. Hi,

    what you show above is exactly what I am looking for: Always getting the latest datarow of a MYSQL database table.
    Unfortunately, I was not able to get your example up and running even though I copied it letter by letter.

    Have you ever executed your code?

    I mean, reacting to, for instance, a change in server time works as expected (see here: http://www.w3schools.com/html/html5_serversentevents.asp) but yours just won’t fire.

    Any feedback is appreciated!

    Mike

Leave a reply to Jaydipsinh Cancel reply