Contact Support
Retry Timeout
8 Jun 20232 minutes to read
The Retry Timeout feature allows you to specify a duration for the PDF Viewer to retry failed AJAX requests before considering them permanent failures. It helps in handling temporary failures due to network issues or server unavailability.
The retryTimeout allows developers to specify a duration after which the AJAX request should retry failed requests automatically. Developers can ensure a more resilient and fault-tolerant PDF viewing experience by configuring an appropriate retry timeout value.
By default, when an AJAX request fails, the Retry Timeout property is set to 0
, indicating that no timeout is set. In this case, the PDF Viewer will wait indefinitely for a response, potentially leading to a hanging request. However, you can set the Retry Timeout property to a positive number, specifying the maximum number of seconds the PDF Viewer should wait for a response. If the response is not received within the specified time, the request will be aborted, triggering an appropriate error or timeout property.
To set the retry timeout, use the retryTimeout
property in the PDF Viewer configuration. This property takes a value in seconds.
<ejs-pdfviewer
id="pdfViewer"
[serviceUrl]="service"
[documentPath]="document"
[retryTimeout]="10"
[retryCount]="5"
style="height:640px;display:block">
</ejs-pdfviewer>
In the given example, the retryTimeout
is set to 10 seconds, and the retryCount
is set to 5. This means that if a request made by the PDF Viewer takes longer than 10 seconds to receive a response, it will be considered a timeout. In such cases, The PDF Viewer will resend the same request based on the retryCount. Here, this process will repeat up to maximum of 5 retries.
When an exception occurs during the AJAX request in the context of the PDF Viewer, the request will wait for the specified retryTimeout
duration. If the timeout duration is exceeded, the PDF Viewer will decrement the retryCount and attempt to load the document again. This retry process continues until the document is successfully loaded or the retryCount limit is reached.
The retryCount
property of the PDF Viewer allows you to set the number of retries for a specific request. This feature is particularly useful for handling temporary errors such as network timeouts or server issues. By initiating new requests according to the retry count, ensure a smoother user experience and efficiently handle network or server problems.
If the timeout duration specified by retryTimeout
is exceeded during the AJAX request, the PDF Viewer will decrement the retryCount
and initiate a new request. This process will continue until the document is successfully loaded or the retry count limit is reached. This functionality helps improve the handling of temporary errors and ensures a more efficient and user-friendly experience.
Find the sample Retry Timeout