php - Send notification from server to client on server event -



php - Send notification from server to client on server event -

how can send message server client php, avoiding extraneous ajax calls.

here idea:

user: alice makes alter gets sent server.

the server checks see users not date, , if not calls code send info pertaining alter bob (who not date in case).

how send bob message?

you can utilize server sent events.

these on looked cousin of websockets lighter weight , 1 way. allow client wait message server (which can respond via different channel such ajax)

example client code:

var source = new eventsource('/newfile'); source.addeventlistener('message', function(e) { // utilize ajax , pull new file here }, false);

unfortuantely seems (of course) there no ie support. 1 utilize library such eventsource hq back upwards cross browser server sent events. abstract away needing handle devil's browser.

php ajax client-server

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -