Title: WP_HTTP_Polling_Sync_Server::register_routes
Published: May 20, 2026

---

# WP_HTTP_Polling_Sync_Server::register_routes()

## In this article

 * [Source](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/register_routes/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/register_routes/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/register_routes/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/register_routes/?output_format=md#wp--skip-link--target)

Registers REST API routes.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/register_routes/?output_format=md#source)󠁿

    ```php
    public function register_routes(): void {
    	$typed_update_args = array(
    		'properties' => array(
    			'data' => array(
    				'type'      => 'string',
    				'required'  => true,
    				'maxLength' => self::MAX_UPDATE_DATA_SIZE,
    			),
    			'type' => array(
    				'type'     => 'string',
    				'required' => true,
    				'enum'     => array(
    					self::UPDATE_TYPE_COMPACTION,
    					self::UPDATE_TYPE_SYNC_STEP1,
    					self::UPDATE_TYPE_SYNC_STEP2,
    					self::UPDATE_TYPE_UPDATE,
    				),
    			),
    		),
    		'required'   => true,
    		'type'       => 'object',
    	);

    	$room_args = array(
    		'after'     => array(
    			'minimum'  => 0,
    			'required' => true,
    			'type'     => 'integer',
    		),
    		'awareness' => array(
    			'required' => true,
    			'type'     => array( 'object', 'null' ),
    		),
    		'client_id' => array(
    			'minimum'  => 1,
    			'required' => true,
    			'type'     => 'integer',
    		),
    		'room'      => array(
    			'required' => true,
    			'type'     => 'string',
    			'pattern'  => '^[^/]+/[^/:]+(?::\\S+)?$',
    		),
    		'updates'   => array(
    			'items'    => $typed_update_args,
    			'minItems' => 0,
    			'required' => true,
    			'type'     => 'array',
    		),
    	);

    	register_rest_route(
    		self::REST_NAMESPACE,
    		'/updates',
    		array(
    			'methods'             => array( WP_REST_Server::CREATABLE ),
    			'callback'            => array( $this, 'handle_request' ),
    			'permission_callback' => array( $this, 'check_permissions' ),
    			'validate_callback'   => array( $this, 'validate_request' ),
    			'args'                => array(
    				'rooms' => array(
    					'items'    => array(
    						'properties' => $room_args,
    						'type'       => 'object',
    					),
    					'maxItems' => self::MAX_ROOMS_PER_REQUEST,
    					'required' => true,
    					'type'     => 'array',
    				),
    			),
    		)
    	);
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/collaboration/class-wp-http-polling-sync-server.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/collaboration/class-wp-http-polling-sync-server.php#L119)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/collaboration/class-wp-http-polling-sync-server.php#L119-L191)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/register_routes/?output_format=md#related)󠁿

| Uses | Description | 
| [register_rest_route()](https://developer.wordpress.org/reference/functions/register_rest_route/)`wp-includes/rest-api.php` |

Registers a REST API route.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_http_polling_sync_server/register_routes/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.0.0](https://developer.wordpress.org/reference/since/7.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_http_polling_sync_server%2Fregister_routes%2F)
before being able to contribute a note or feedback.