Share this page

# Example: Asynchronous Conversations

    //Automatically generated file for implementing asynchronous callback functions.
    //You can modify the automatically generated callback implementations or add new ones.
    //Asynchronous callback functions can be registered using web_reg_async_attributes steps.
    function Push_0_RequestCB()
    {

    	lr.outputMessage(">>> Push_0_RequestCB");

    }

    function Push_0_ResponseHeadersCB(
    	aHttpStatusCode,
    	aAccumulatedHeadersStr,
    	aAccumulatedHeadersLen)
    {
    	//Enter your implementation for ResponseHeadersCB() here.

    	lr.outputMessage(">>> Push_0_ResponseHeadersCB " + aHttpStatusCode + " / "
    	                 + aAccumulatedHeadersStr.substr(0, 10) + " / "
    					 + aAccumulatedHeadersLen);

    }

    function Push_0_ResponseBodyBufferCB(
    	aLastBufferStr,
    	aLastBufferLen,
    	aAccumulatedStr,
    	aAccumulatedLen,
    	aHttpStatusCode)
    {
    	//Enter your implementation for ResponseBodyBufferCB() here.

    	lr.outputMessage(">>> Push_0_ResponseBodyBufferCB "  + aLastBufferStr.substr(0, 20)
    	                    + " / " + aLastBufferLen + " / " + aAccumulatedStr.substr(0, 20)
    						+ " / " + aAccumulatedLen + " / " + aHttpStatusCode);

    }

    function Push_0_ResponseCB(
    	aResponseHeadersStr,
    	aResponseHeadersLen,
    	aResponseBodyStr,
    	aResponseBodyLen,
    	aHttpStatusCode)
    {
    	//Enter your implementation for ResponseCB() here.

    	//TODO - To make the script wait for a specific response, use web_sync in the relevant Action file.
    	//See the Modifying Callbacks section in the VuGen Help Center for more details.
    	lr.outputMessage(">>> Push_0_ResponseCB " + aResponseHeadersStr.substr(0, 20) + " / "
    	                     + aResponseHeadersLen + " / " + aResponseBodyStr.substr(0, 20) + " / "
    						 + aResponseBodyLen + " / " + aHttpStatusCode);

    }

    function Action()
    {

    	web.regAsyncAttributes(
    		{
    			id: "Push_0",
    	        pattern: "Push",
    	        url: "http://myserver.abc.com/cgi-bin/nph-pushJS_FF.exe",
    			//requestCB: =Push_0_RequestCB",
    			responseHeadersCB:	'Push_0_ResponseHeadersCB',
    	        responseBodyBufferCB:
    				function Push_0_ResponseBodyBufferCB(
    					aLastBufferStr,
    					aLastBufferLen,
    					aAccumulatedStr,
    					aAccumulatedLen,
    					aHttpStatusCode)
    				{
    					//Enter your implementation for ResponseBodyBufferCB() here.
    					lr.outputMessage(">>> Push_0_ResponseBodyBufferCB " + aLastBufferStr.substr(0, 20)
    					                 + " / " + aLastBufferLen + " / " + aAccumulatedStr.substr(0, 20)
    									 + " / " + aAccumulatedLen + " / " + aHttpStatusCode);
    				}
    		});

    	web.url(
    		{
    			name: "push_to_iframe_new_object_FF.html",
    			url: "http://myserver.abc.com/webgui/push/push_to_iframe_new_object_FF.html",
    			resource: "0",
    			recContentType: "text/html",
    			snapshot: "t1.inf",
    			mode: "HTML",
    		});

    	lr.thinkTime(30);
    	web.stopAsync("Push_0");

    	return 1
    }

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: