Skip to content

TWebClientConnection

Description

TWebClientConnection is a non-visual component that can take of the loading of TWebClientDataSet data via a HTTP request returning a JSON array

Properties for TWebClientConnection

Property Description
Active Property to set the connection to active. Setting Active = true means the TWebClientConnection will try to fetch the data from the URL that is set with the URI property
AutoOpenDataSet When true, the dataset using the TWebClientConnection will be automatically set to Active = true after the JSON array response of the HTTP request is loaded
Command Sets the HTTP command to use for retrieving the dataset information. The default command is httpGET. httpCUSTOM : a custom HTTP command set with WebHttpRequest.CustomCommand httpDELETE : a HTTP DELETE command httpGET : a HTTP GET command (default) httpHEAD : a HTTP HEAD command httpPOST : a HTTP POST command
httpPUT : a HTTP PUT command
CustomCommand Specifies the HTTP custom command to use when Command is set to httpCustom.
DataNode Sets an optional JSON node name under which the JSON array of data can be found. Note that for nodes hierarchically multiple lebels deep, DataNode can be specified with backslash to separate hierarchical nodes. Example: ‘NodeTopLevel\NodeSubLevel’
Headers Can contain optional HTML headers to be sent to the server when making the HTTP(s) request to retrieve the data
Password Sets the password to be used in case the HTTP(s) request needs authentication
PostData Data that is posted to the server when needed for the HTTP request
URI Sets the URL
User Sets the user name to be used in case the HTTP(s) request needs authentication

Methods for TWebClientConnection

Method Description
Close Closes the connection and when AutoOpenDataSet=true, it will also set the dataset.Active property to false
Open: TJSPromise This is a promise based version of setting Active to true

Events for TWebClientConnection

Event Description
AfterConnect Event triggered after the connection was successful
BeforeConnect Event triggered before the HTTP(s) request will be performed
OnConnectError Event triggered when the HTTP(s) request was unsuccessful
OnDataReceived Event triggered when data from the server was returned.