English (United Kingdom)
Knowledge Base  >  Vik Appointments  >  Hooks  >  Web Hooks  >  Close HTTP Connection

apply_filters( 'vikappointments_before_close_http_connection', bool $status )

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.


Parameters

$status

(bool)  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.
 *
 * @param  boolean  $status  False to avoid closing the connection. 
 */
add_filter('vikappointments_before_close_http_connection', function($status)
{
    // do not close the connection
    return false;   
});

Changelog

Version Description
1.2 Introduced.
Last Update: 2021-10-08
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information