For a list of protocols that support asynchronous communication, see Protocol support for 64-bit recording, Async, and IPv6.
After VuGen scans a Vuser script for asynchronous communication, the Async tab of the Design Studio lists the asynchronous conversations that were found in the script. For each asynchronous conversation found during the scan, VuGen adds the callback function signatures matching those declared in the web_reg_async_attributes step. The signatures are added to the AsyncCallbacks.c extra file.
The names of the callback functions start with the conversation ID of the asynchronous conversation. For example, the RequestCB callback for an asynchronous conversation with ID “LongPoll_0” will be LongPoll_0_RequestCB.
The names of the callback functions are declared in the web_reg_async_attributes step in the script.
The available callbacks are:
This callback is called before a request is sent.
This callback is called when there is content in the response body buffer and at the end of the response body. This callback is generated by VuGen automatically for push-type conversations, but is available for poll and long-poll conversations as well.
This callback is called after every response is received in the conversation.
In the following sample code, the three callback functions are declared in the web_reg_async_attributes step.
In the following sample code, the two callbacks are implemented in the AsyncCallbacks.c extra file.
You can modify the callbacks to implement the required behavior. For details, see Modify callbacks.
The following sample code shows an implementation of the ResponseHeader callback function, including the three arguments: HTTP Status code, Accumulated headers string and Accumulated headers string length.
const char * aAccumulatedHeadersStr,
//Enter your implementation for ResponseHeadersCB() here.
lr_output_message("Response status code is :[%d]", aHttpStatusCode);
lr_output_message("Response headers are :/n[%s]", aAccumulatedHeadersStr);
A sample of the output from the above callback function is shown below:
Response status code is :
Response headers are :
[HTTP/1.1 200 OK
Date: Tue, 25 Jun 2013 09:03:33 GMT