Asynchronous example - push
For a list of protocols that support asynchronous communication, see 64-bit recording, Async, and IPv6 support.
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 continues 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 displays 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 "http://push.example.com" [MsgId: MERR-27782]
The error indicates that the response never finished.
Regenerating the script, with Async Scan enabled, creates 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.