HTTPworker

External objects

Properties Methods 

Properties

$alwaysfinishIf true,the worker allows an asynchronous request to run to completion even if the instance containing the worker closes
$callbackinstThe instance to which the worker object sends messages,for example when its processing has completed or has been cancelled.If you do not assign an instance to $callbackinst the worker object sends messages to itself
$callprogressIf true,the worker periodically generates a notification to $progress as it executes.Defaults to false
$curloptionsUse this property to set internal CURL options not otherwise exposed by the worker.A 2 column list,where column 1 is a number (the CURL easy option number) and column 2 is a string.The internal option must be an integer or string value
$errorcodeError code associated with the last action (zero means no error)
$errortextError text associated with the last action (empty means no error)
$followredirectsIf true,the HTTP request will follow a server redirect in order to complete the request
$oauth2An object reference to an OAUTH2Worker object containing the authorization information required to make requests to the server.Clear this property by assigning #NULL to it.$authorize() cannot run while the OAUTH2Worker is assigned to $oauth2
$protocollogIf non-zero,the worker adds a log of protocol activity as a column named log to its wResults row.Defaults to kOW3logNone.Otherwise,a sum of kOW3log... constants
$proxyauthpasswordThe password used to authenticate the user when connecting to $proxyserver using $proxyauthtype
$proxyauthtypeThe type of HTTP authentication to use when connecting to $proxyserver.A kOW3httpAuthType... constant
kOW3httpAuthTypeBasic kOW3httpAuthTypeDigest kOW3httpAuthTypeNone
$proxyauthusernameThe user name used to authenticate the user when connecting to $proxyserver using $proxyauthtype
$proxyserverThe URI of the proxy server to use for all requests from this object e.g. http://www.myproxy.com:8080.Defaults to empty (no proxy server)
$proxytunnelIf true,and $proxyserver is not empty,requests are tunnelled through the HTTP proxy
$responsepathIf not empty,the worker writes response content to the file with this path rather then adding it to the wResults row.The file must not already exist.Defaults to empty
$stateA kWorkerState... constant that indicates the current state of the worker object
kWorkerStateCancelled kWorkerStateClear kWorkerStateComplete kWorkerStateInit kWorkerStateRunning
$threadcountThe number of active background threads for all instances of this type of worker object
$timeoutThe timeout (in seconds) for requests.Zero means requests do not time out.For the OAUTH2Worker defaults to 60 with a minimum value of 10;otherwise,defaults to 10 with a minimum value of zero
$wspingintervalIf non-zero,and the connection is to a web socket server,the HTTP worker sends a Ping frame to the server every $wspinginterval seconds of inactivity,and closes the connection if a Pong frame is not received after $wspongtimeout seconds
$wspongtimeoutThe number of seconds (1-60, default 5) the client waits to receive a Pong frame after sending a Ping frame as a result of the $wspinginterval timeout expiring

Methods

$cancel$cancel() If required,cancels execution of worker on background thread.Will not return until the request has been cancelled
$cancelled$cancelled() Method called when the request has been cancelled
$completed$completed(wResults) Method called when the request completes.wResults is a row containing the results of executing the request
$getsecureoptions$getsecureoptions([&bVerifyPeer,&bVerifyHost,&cCertFile,&cPrivKeyFile,&cPrivKeyPassword]) gets the options that affect how secure connections are established (the options do not apply to SFTP)
$init$init(cURI[,iMethod=kOW3httpMethodGet,lHeaders=#NULL,vContent='',iAuthType=kOW3httpAuthTypeNone,cUserName='',cPassword='']) Initialise the object so it is ready to perform the specified HTTP request.Returns true if successful
$multipartaddfield$multipartaddfield(cName,cFieldData[,lPartHeaders]) Adds a field part to the multipart/form-data content stored in the worker object.To send this content specify kOW3httpMultiPartFormData as the vContent parameter to $init()
$multipartaddfile$multipartaddfile(cName,vFileData[,cFileName='',lPartHeaders]) Adds a file part to the multipart/form-data content stored in the worker object.To send this content specify kOW3httpMultiPartFormData as the vContent parameter to $init()
$multipartclear$multipartclear() Frees any previously generated multipart/form-data content.Note that calling $run or $start with kOW3httpMultiPartFormData results in the multipart/form-data content being automatically freed after use
$progress$progress(wProgress) Method called during worker execution to report progress (see $callprogress property)
$run$run() Run worker on current thread.Returns true if the worker executed successfully
$setsecureoptions$setsecureoptions([bVerifyPeer=kTrue,bVerifyHost=kTrue,cCertFile='',cPrivKeyFile='',cPrivKeyPassword='']) sets the options that affect how secure connections are established (the options do not apply to SFTP)
$start$start() Run worker on background thread.Returns true if the worker was successfully started
$wsclose$wsclose([bDiscardUnsentMessages=kFalse,iStatusCode=1000,cReason='']) Closes the connection to the web socket server. $completed() will be called when the connection has closed
$wssend$wssend(vMessage) Sends the supplied message on a connected web socket.Returns true if successful,which means the message has been queued for sending
$ws_onconnect$ws_onconnect(wRow) Method called when a web socket connection has been successfully established
$ws_onmessage$ws_onmessage(wMessage) Method called with a complete message received from the web socket server