I am quite new to real-time data with Socket.IO. I am trying to figure out what is the best way to handle data coming in from Socket.IO in an AngularJS ng-repeat?
Right now I have the backend sending up the entire data structure every time there is an update to it.
But this is causing the ng-repeat to refresh in order to display the new data (if I make any modifications to the data on the client side only, they are removed next time data is sent from the backend). Is there a better way to do this?
Should I filter out the only data that requires updating on the backend and then send that to the front end instead of delivering the entire data structure again? (But then how would I apply this in an ng-repeat with only the update data...)
I tried using UnderscoreJS extend method in the frontend but it seems to cause issues with the sorting of data in ng-repeat (orderBy and filter both break).
My specific use case is dealing with sports scores (several games (objects) in an array), I am constantly getting updates on my data whether they are the time changing in a game, or a scoring play. Updates are happening pretty much every second. I am tapping into this specific API and grabbing all the data on a specific refresh variable, then sending it to the front-end via a socket. Not the ideal case to use sockets really, but it is the only way to interact with the API that I have discovered so far.