I am just wondering if you can reload the present page with jQuery or AJAX, once the database continues to be transformed in certain sort? If this sounds like possible, how do you allow it to be reality on my small website?
Illustration showing what i'm saying: Allows say that certain customer is situated around the frontpage from the website. The customer is simply idle around the page after i publish a brand new blogpost. The page reloads using jQuery or AJAX if this sees the brand new blogpost within the database, and show the brand new publish for that customer. Simliar function for this is
setTimeout(), but I'd rather not stress the server basically have 100 active site visitors on a single page.
Thanks ahead of time.
var MyItemID = get_file_contents(notice.html) on-page, use
setTimeout() for request content from
notice.html and compare result together with your
Each time, whenever you improve your DB, get max entry's ID via
mysql_insert_id() and set it in to the
Pretty easy, yeah? )
AFAIK you cannot allow the server push to clients over HTTP on the server event (I would be wrong here), you should use the SPDY protocol in case your clients support it (I believe just the chrome browser does).
Therefore the only factor you should do is see if the most recent record is equivalent to it had been on pageload. You need to seek advice from the server each X seconds/minutes.
You can accomplish this by doing something similar to this:
- upon pagerequest keep ID from the latest record somewhere around the page (hidden input for instance).
- Write a little serverscript to come back just the ID from the latest record (plain)
- Do a comparison around the client, when they don't match perform a full ajax request the brand new content
The only real factor the server must do (each X sec per client) is query the database for that latest record and output it plain. You may also check up on the server (more server load) or output it via JSON (also more server load).
I do not think it can be done without individuals inspections.