Chapter 6. Communicating in Real-Time via Messages

Over the history of web applications, we have become comfortable with viewing application interactions as a series of requests and responses. Users and their agents, which are often called clients, pull data from servers or ask the server to carry out a set of actions; the server, in turn, manipulates and modifies data. Web applications, until recently, hardly ever involved data pushing, initiated by a server. Such interactions remained in the realm of the server-centric applications and the desktop.

Part of the reason behind the request-response model is the stateless nature of HTTP. In its plain vanilla form, HTTP works fine for static resource access. However, the statelessness gets tricky with applications. Many applications require that the system remember who the client is so that requests subsequent to the first one can be associated with the original request. Keeping this continuity avoids repeated authentication, helps maintain transactional integrity, and implements a conversation between a user and a system. From the very first few such requirements, developers figured out hacks for maintaining such state across multiple requests and created the concept of a session, which has become part of the standard HTTP repertoire.

Once stateful web applications were possible, the next challenge was to break the synchronous nature of the request-response model. The XMLHttpRequest object and Ajax were the frontrunners in this area. They set the tone for asynchronous processing on the web. Full-blown RIA frameworks, such as Flex, took this to the next step, where every important interaction is asynchronous.

However, server-initiated data pushing was still fairly alien until a couple of years back. Things are different now. Data pushing from a server to a browser-based application is not only possible but a viable option for creating serious applications. The initial attempts to push data based on continuous polling have given way to more sophisticated and robust alternatives. In this chapter, you will learn to push data up to Flex clients and understand the intricacies involved in making that happen.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.89.18