Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialIlhyun Jo
6,288 PointsHow do you keep the content up to date after loading once.
Even if you use the ever-changing database on the server to load the data, how can you make it so that the program keeps checking for changes on the database. It seems to me that once you load the program with data there's no method to check if the database ever changed afterwards. Is there a way to check without refreshing?
1 Answer
Kevin Korte
28,149 PointsYes, but it starts to get a lot more complicated. The old school was was to poll the server in the background for changes. What that meant is that, client continued to ask the server for changes, and would ajax in whatever it got back. This of course is resource intensive on the server.
Than long polling, where the client made a request, and the request kinda lingered for awhile, until a change happend, or it was closed, and than a new poll would be started again.
Today, the best way is to use sockets, to establish a connection between client and server. With a socket, you'll live live updates. The framework Meteor.js has this built into it's core framework.
Ilhyun Jo
6,288 PointsIlhyun Jo
6,288 PointsThanks I'll add Meteor.js to my studylist.
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsMeteor is great. I'm using it in a project right now.