ZK Asynchronous call

asked 2023-05-03 20:29:52 +0800

Akshay70123 gravatar image Akshay70123

How to implement asynchronous call in zk community edition ZK in order to update data on the form in every 10 second.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2023-05-09 20:56:57 +0800

MDuchemin gravatar image MDuchemin
2390 1 6
ZK Team

If you want to get an event every 10s during which you can update the content of the page, consider a repeating timer: https://www.zkoss.org/wiki/ZKComponentReference/Essential_Components/Timer

Timer will generate an "onTimer" event on a period defined by the "delay" attribute. Remember to set both delay and repeats if you want an ongoing event: delay="10000" repeats="true" -> every 10s

Alternatively, you can consider server-push: https://www.zkoss.org/wiki/ZKDeveloper'sReference/Server_Push/Configuration CE edition has polling server-push available, which enables you to trigger updates from server-side. In the case you described, I'd still go with timer since you want to do periodic updates though. Server push use case is more along the line of "I want to update the client after an unknown period of time, or when something happens at server side."

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2023-05-03 20:29:52 +0800

Seen: 7 times

Last updated: May 09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More