HTTP is a request-and-response protocol. Technically, there is no way to have the server to actively push data to the client. However, there are a few approaches to emulate push -- it is also called Ajax Push. We can summarize these approaches in 2 categories:
- client polling and
- comet (more precisely, it is the so-called long polling)
They are both supported in ZK.
Different approaches have different pros and cons, and we will discuss them in the Configuration section.
No matter which implementation you choose, the usage is the same. The Event Queue is the high-level API, and this is a suggested approach for its simplicity. However, if you prefer to access the low-level API directly, you could refer to the Asynchronous Tasks and Synchronous Tasks sections, depending on whether your task can be executed asynchronously.
Browser Concurrent Connection Limitation
The server push (exception polling) establishes an open connection. Modern web browsers typically impose a limitation on the number of simultaneous HTTP connections that can be established with a single domain. According to the HTTP specification outlined in RFC2616, this constraint is commonly set to a maximum of 6 concurrent connections per domain.