public function onBeforeWebhookCloseHttpConnection() : bool

Fires before closing the HTTP connection.


Description

The web hooks are always queued and deployed after presenting the HTML document. In order to avoid waiting for the completion of the requests, the system terminates the page loading by using the native fastcgi_finish_request() PHP function, when available.

It is possible to use this hook to safely prevent the closure of the HTTP connection at runtime. This way we can prevent any errors that might occur with certain server configurations.

NOTE: this filter doesn't trigger in case the fastcgi_finish_request() function is not available.


Return Value

Boolean. False to prevent the HTTP connection.


Example

/**
 * Trigger hook to safely prevent the closure of the HTTP connection at runtime.
 * This way we can prevent any errors that might occur with certain server
 * configurations.
 *
 * @return  boolean  False to avoid closing the connection. 
 */
public function onBeforeWebhookCloseHttpConnection()
{
    // do not close the connection
    return false;   
}

Changelog

VersionDescription
1.7 Introduced.
Last Update: 2021-10-08 16:28
Helpful?