Making Periodic AJAX Calls via a Polling Processor
This example demonstrates how to add Polling (a.k.a. "Periodical Updates") to your QForms. This polling
mechanism can be used to simulate a real-time stream from the server to client. Some common use cases
include progress bars and web-based chat applications.
We add polling to our QForm by calling SetPollingProcessor
, passing in the
name (and optionally the parent object) of the user-defined method to repeatedly call, and (also optionally)
the polling interval in milliseconds (default is 2.5 seconds). In this example, we are updating the clock
below with the current time every second. Clicking the button stops the polling by calling
Finally, note that because every polling recurrence involves an HTTP request to the server, care should
be taken when setting the polling interval to avoid excessive server load.