WP_HTTP_Polling_Sync_Server::add_update( string $room, int $client_id, string $type, string $data ): true|WP_Error

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

Adds an update to a room’s update list via storage.

Parameters

$roomstringrequired
Room identifier.
$client_idintrequired
Client identifier.
$typestringrequired
Update type (sync_step1, sync_step2, update, compaction).
$datastringrequired
Base64-encoded update data.

Return

true|WP_Error True on success, WP_Error on storage failure.

Source

private function add_update( string $room, int $client_id, string $type, string $data ) {
	$update = array(
		'client_id' => $client_id,
		'data'      => $data,
		'type'      => $type,
	);

	if ( ! $this->storage->add_update( $room, $update ) ) {
		return new WP_Error(
			'rest_sync_storage_error',
			__( 'Failed to store sync update.' ),
			array( 'status' => 500 )
		);
	}

	return true;
}

Changelog

VersionDescription
7.0.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.