0

I am creating a webpage to show the listing from my database table, suppose my database table is updating in every 10 second from my php cron , then i want to sync my backbone model/collection whenever my database table get update from my php cron.

Example:- i have table stock_exchange in which i am storing the stocks rate for various companies, and my cronjob update the stocks rate in every 10 second, To show this on UI i am creating the backbone application but my problem is that whenever my table stock_exchange updated i want to sync my backbone model/collection.

Please help, Thanks in advance

user562451
  • 65
  • 1
  • 8

1 Answers1

2

You can either poll the server by calling stockModel.fetch() every 10 seconds in the browser (via setInterval perhaps), or you can use something like web sockets (via socket.io perhaps) to allow the server to push the latest data to the browser, which you can then do stockModel.set(dataFromServer);. Try something and post some code as stack overflow is intended for specific problems not tutorials.

Peter Lyons
  • 142,938
  • 30
  • 279
  • 274