Method HttpClient():sendAsync() Foundation

Sends an asynchronous request to the server.

Syntax
 
:sendAsync() --> self 
Return

:sendAsync() returns the object executing the method.

Description

The method :sendAsync() sends a HTTP request to the server. Unlike :send(), this method executes asynchronously, which means it does not wait for the server's response. Instead, :sendAsync()initiates the request and returns immediately, allowing the application to continue executing while the request is processed.

The method :wait() can be used for waiting for request completion. In addition, callback methods such as :onBusy() are available for monitoring the various states of a send operation.

Once processing is complete, the status of the operation is reflected in the HTTP status code returned by :getStatusCode(). The HTTP status code should be checked prior to accessing the response data for ensuring the request was completely processed. The full details of the server's response are accessible via the HTTP response object stored in the :HttpResponse member variable.

Responses with a large amount of data are cached in temporary files in order to avoid using up excessive memory. In these cases, the content in the response is only available until the :disconnect()method is called. Accessing the content after calling :disconnect() raises a runtime error.

The method :disconnect()must be used for disconnecting the HttpClient object when done processing the request. Otherwise, resources may not be freed or may remain allocated until the application terminates.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.