This is a question i’ve been pondering about for a while 🙂 Clients are often asking if it’s possible to create a real-time page update whenever they upload i.e. a video to their YouTube account, add new images to their Flickr account and such. So basically the scenario would be something like:
- Client A visits http://www.mywebsite.com which presents a list of youtube videos or flickr images.
- The administrator uploads a new video on youtube or uploads new images to his/her flickr account.
- When the video/images has been uploaded, the http://www.mywebsite.com gets notified about the changes and updates the lists that Client A is viewing on the fly.
I know this screams for the observer pattern, but I don’t think that can be used crossdomain, no? 🙂
Another solution would be to make an AJAX call for every X minute to RSS feeds or YouTube/Flickr APIs.
Anyone knows about best practices when developing this? Any help/hint will be greatly appreciated.
Schedule some kind of task that reads the RSS/API and populates the database with the new information.
The page does an AJAX request periodically checking for new values in the database (maybe set a read value, or base it off a date time of the last check), and AJAX’es the magic onto the page.
Theres no reason why the AJAX couldn’t schedule the RSS/API check, but I doubt that would scale.
Ideally, I’d write a service outside of ASP.NET that would do that check, and just populate the database with the results.