otm:ordering_of_messages

This is an old revision of the document!


Ordering of messages

Ajax are a group of interrelated Web development technologies used on the client-side to create interactive Web applications. With ajax, Web applications can retrieve data from the server or other clients asynchronously in the background. As the figure below shows, a Web application sends requests to the network (eg. servers or other Web applications) and later this Web application retrieves responses, which are processed by user defined functions, named callbacks.

 Ajax requests

Unsurprisingly, the responses of ajax requests can be retrieved in an arbitrary order, which not necessarily respect the order in which their associated requests are sent. This feature brings unexpected (and not easily controllable) results when these responses are processed in a particular order. To control these unexpected results, OTM allows developers to define expressively the strategy of order of the executions of these responses. Next, we present three examples that show the use of different strategies of ordering.

  1. Fifo. The fifo strategy executes the responses in the same order in which their associated requests are sent. This example illustrates how to define and use the fifo strategy to create and show correctly a Web page.
  2. Discard Late. The discard late strategy does not execute the responses that are retrieved late (eg. the first response is not executed or skipped if the second was already executed). This example illustrates how to define and use the discard late strategy to show correctly the flow of a streaming media.
  3. Discard Early. The discard early strategy does not execute the responses that are retrieved early (eg. the second response is not executed if the first has not executed yet). This example illustrates how to define and use the discard early strategy to show correctly the first posts of a thread in a forum.

Go OTM home.

  • otm/ordering_of_messages.1295221828.txt.gz
  • Last modified: 2011/01/16 19:50
  • by aspectscript