Asynchronous Example - Push

Note: Applies to Web - HTTP/HTML, Flex, and Web Services Vuser scripts.

The following example describes a Vuser script that is developed to emulate a browser displaying an application that utilizes push-type asynchronous conversations. The application is a demo of a “stock quote” page. The browser shows the page with the stock values, and then sends a request and receives a response with updated stock values. The request remains open until it is closed by the user. For as long as the page is displayed, the server will continue to send sub-messages as part of the response - whenever the server has an update for the displayed stocks. Whenever such a sub-message is received by the client, the client displays the updated stock values.

Note: You can modify VuGen's asynchronous request thresholds to assist VuGen in finding push-type conversations. For details, see Using Asynchronous Request Thresholds.

If you attempt to run a script that calls a push url - without first performing an asynchronous scan - the replay will halt while waiting for the response to the highlighted request. After two minutes, VuGen will display an error similar to the following, in the Replay log:

Action.c(140): Error -27782: Timeout (120 seconds) exceeded while waiting to receive data for URL "" [MsgId: MERR-27782]

The error indicates that the response never finished.

Regenerating the script with Async Scan enabled will create a script similar to the following:

Notice that a web_reg_async_attributes function has been added before the web_url function that starts the push conversation, and that a web_stop_async function has been added after the last action step in the script. The script will now run successfully. The push conversation will remain active – running in parallel with the other script functions – until the web_stop_async function, or until the end of the script is reached.

Note that during the Async scan, VuGen did not remove (comment-out) any of the generated code in the Vuser script.

Back to top