4.5.10 Empty Sync Request and Response
This section demonstrates a scenario in which an empty Sync request (section 2.2.1.21.1) and an empty Sync response (section 2.2.1.21.2) are exchanged between the client and server.
The scenario begins when a Sync request is issued by the client and indicates that there are no pending changes to report to the server. The Sync request is as follows:
-
<?xml version="1.0" encoding="utf-8"?> <Sync xmlns="AirSync"> <Collections> <Collection> <SyncKey>560109801</SyncKey> <CollectionId>5</CollectionId> <DeletesAsMoves>1</DeletesAsMoves> <GetChanges>1</GetChanges> <WindowSize>512</WindowSize> </Collection> </Collections> <HeartbeatInterval>60</HeartbeatInterval> <WindowSize>512</WindowSize> </Sync>
When the server receives this Sync request and determines that it contains no changes, it caches the request for future use. The server then responds to the Sync request with an empty Sync response when no changes or errors have occurred on the server. The empty Sync response is as follows:
-
HTTP/1.1 200 OK Date: Fri, 10 Apr 2009 20:32:39 GMT Content-Length: 0
When the client receives the empty Sync response, it can in turn send an empty Sync request if there are no pending changes. The empty Sync request is as follows:
-
POST /Microsoft-Server-ActiveSync?Cmd=Sync&User=DeviceUser&DeviceId=v140Device&DeviceType=SmartPhone HTTP/1.1 Content-Type: application/vnd.ms-sync.wbxml MS-ASProtocolVersion: 14.0 X-MS-PolicyKey: 2401271238 User-Agent: ASOM Host: contoso.com
The exchange of the empty Sync requests and responses continues until a change is detected on either the client or server, at which time a Sync request or response with an XML payload is sent.