php - Best way for instant messaging system without Websockets -
i have webserver i'm renting host. don't allow webrtc or node.js or that.
i have messaging system using php/sql/ajax (when user's viewing message thread, fetches new data every 60 seconds) doesn't seem instant , seems it's not convenient server if lot of users on.
so, question is: there way can live-update data users without having request new data , not having use websockets?
i'd implement notifications , comments well, having lot of ajax scripts requesting data every x amount of seconds doesn't seem idea.
personally, suggest best solution problem use websocket
. that's effective way far. , regarding this:
they don't allow webrtc or node.js or that.
you can find hosting can allow run websocket servers. example https://www.digitalocean.com can setup/install own socket server in hosting.
i have messaging system using php/sql/ajax (when user's viewing message thread, fetches new data every 60 seconds) doesn't seem instant , seems it's not convenient server if lot of users on.
i think method use right ajax polling
persistently request on every interval new updates in database. okay minimal updates don't recommend using method. @ every request per interval affecting app speed , performance in long run. that's why correct:
i'd implement notifications , comments well, having lot of ajax scripts requesting data every x amount of seconds doesn't seem idea.
and this:
so, question is: there way can live-update data users without having request new data , not having use websockets?
yes, there way using sse (server-sent events). check example w3fools :d.
but in case consider websockets again, may try websocket php: ratchet.
also check out: ways make request/get realtime updates web application.
Comments
Post a Comment