i'm making app accesses database , updates data every view seconds on php script, problem updates data, know how program dynamically updates data , decides data update , not, keeps track of change somehow. how best go along doing ?
i think there should question has asked couldn't find maybe can show me website look.
in general, need user either xhr requests, web sockets, or http/2 solve problem. since http/2 not universally supported on browser side, may not work you. here outline of solution:
every few seconds, javascript provide in browser need poll server updates using xhr request. can use returned data update screen javascript. if want simple updates, updating numbers, might use raw javascript or jquery. if polling result in complex screen updates or want move lot of functionality client, want redo client using 1 of javascript frameworks react or angular.
use web sockets (or http/2) create persistent connection server, , have server send updates clients data changes. require code in application broadcast or multicast updates. client code similar case 1, except client not poll updates.
the polling solution easier implement, , choice long don't have many clients sending polls @ high rate - can overwhelm servers way.
Comments
Post a Comment