By default the TsgcHTTP1client uses blocking requests, so after calling an HTTP Request method, the client waits the response from the server. From sgcWebSockets 2025.3.0 you can use Asynchronous methods to execute these HTTP Requests in a secondary thread avoiding to block the thread where the requests is called. The following asynchronous methods are implemented:
- GetAsync
- PostAsync
- PutAsync
- OptionsAsync
- DeleteAsync
After calling these methods, instead of waiting the response, the code continue to the next line, and the response can be handled using the event OnAsyncResponse.
If there is any error while processing the Asynchronous request, the exception will be raised in the event OnAsyncException.
Delphi Example
Request an Asynchronous POST method and read the response using the OnAsyncResultEvent.