15.2. The Server Application
In a perfect world, an application such as FooReader.NET would be strictly client-side. JavaScript would be able to retrieve XML feeds across domains with XHR, and there would be no need to make any calls to a server component. Because of JavaScript's security restrictions, however, it is not possible to retrieve data from a different domain; thus, a server-side component is required.
15.2.1. Possible Paradigms
The server's job in FooReader.NET is to retrieve the remote XML feeds for the client to use. Following this model, there are two possible design paths for the server; both have their pros and cons.
The first method is a cached feed architecture. The server program would act as a service, fetching a list of feeds at a certain time interval, caching them, and serving the cached feeds to the client when requested. This option potentially saves bandwidth, but it also risks the reader not having up-to-date feeds. More user action would be required to display the current, up-to-date feeds, which goes against the Ajax ideology.
The second method is a delivery on demand architecture, where the server would retrieve any given feed when the user requests it. This may use more bandwidth, but it ensures the reader will have up-to-date information; moreover, this design is inline with the Ajax concepts and is what the user would expect.
15.2.2. Implementation
The solution implemented in FooReader.NET uses a hybrid approach. The requested feeds are retrieved ...
Get Professional Ajax, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.