Skip to content
Docs
Get RestroPress

Filter

rpress_realtime_client_config

Updated
On this page

Filters the realtime client configuration sent to the order tracker.

Runs at the end of RPRESS_Realtime::get_client_config_for_payment() when realtime updates are enabled. The array contains enabled, provider, key, cluster, forceTLS, channel, event and script_url, plus wsHost, wsPort and wssPort when custom hosts or ports are configured. It is public data in the page, so do not add secrets.

Parameters#

ParameterTypeDescription
$clientarrayClient config passed to the frontend script.
$payment_idintPayment ID.

Return value#

array. The client config.

Example#

function my_realtime_client_config( $client, $payment_id ) {
	$client['wsHost'] = 'ws.example.com';
	return $client;
}
add_filter( 'rpress_realtime_client_config', 'my_realtime_client_config', 10, 2 );

Notes#

When realtime is disabled or the payment ID is empty the method returns array( 'enabled' => false ) before this filter runs.

Source#

Applied in:

  • includes/class-rpress-realtime.php (line 68), in RPRESS_Realtime::get_client_config_for_payment()

See also#

Was this page helpful?