3.5.2.3 Polling Encapsulation Timer
The polling encapsulation timer is used by clients to determine the next interval for polling the server. Because the POST session is half-duplex, a polling mechanism is needed to allow the server to send data to the client, even when the client has no data to send the server. The timer value algorithm has a built in back off mechanism to reduce the overhead of the client polling the server for application data.
The Poll Timer is comprised of three values that are updated by the client on every response received from the server. These values are MaxPollInterval, MinPollInterval, and PollRepetitions. MinPollInterval is measured in seconds and defines the starting poll interval value. PollRepetitions defines the amount of times the client polls using the initial starting value. MaxPollInterval is measured in seconds and defines the poll interval ceiling. Together these values are used to implement the back off algorithm used to manage the frequency at which a client polls the server for data.
The Poll timer determines the current poll interval to be used for the next poll request. The current poll interval value is initialized with the MinPollInterval value. Using the current poll interval, the client polls the number of times specified by PollRepetitions. When the current repetition count reaches the PollRepetitions value, the current poll value is doubled and becomes the new poll interval. This interval is also used by the client to poll the server the number of times specified by PollRepetitions. The doubling of the current poll interval continues until the interval exceeds the MaxPollInterval value. When the MaxPollInterval value is exceeded, the client continues to poll the server indefinitely, using the current value. Polling SHOULD continue at the current poll interval, until the client has data to send to the server, at which point the client resets the current poll interval back to MinPollInterval value. The back off algorithm resets and starts over again.
Once the client establishes a Polling connection, the per-connection polling interval is updated with the server’s timer values. The server Poll timer values are returned on the last Polling-POST-Response message of the Polling connection handshake and on every subsequent Polling-POST-Response message. The poll value applies to the next poll operation. Clients SHOULD refresh their local Poll timer values after every Polling-POST-Response, if the timer values changed in the latest Polling-POST-Response message from the server. The Poll Timer values are scoped to a single connection. When the client receives data from the server, the Poll timer values are reset back to the Poll timer values found in the current Polling-POST-Response.
The recommended Poll timer values used for Polling for application data are specified in section 2.2.4.2.1.1. The maximum poll interval value used by polling connections is constrained by limits imposed by firewall and proxies<42>. The Poll timer event processing is handled as specified in section 3.5.6.3. The recommended MaxPollInterval, MinPollInterval, and PollRepetitions values are 120, 5, and 3, respectively.