Project

General

Profile

Widgets sync or async?

Added by Txt Only about 3 years ago

I just want to know if I programmingly change a widget's state from server-side, for example, setChecked() of a WCheckBox, is it sync or async?
Do I have to wait until it's changed on the client-side?

Thanks.


Replies (6)

RE: Widgets sync or async? - Added by Korneel Dumon about 3 years ago

This method will change the state of WCheckBox and mark it as dirty (so no immediate communication to the client). After all event handling is done, Wt will collect all changes from dirty widgets and push them to the client.

RE: Widgets sync or async? - Added by Txt Only about 3 years ago

So it's basically async then. Just what I needed.
Thanks.

RE: Widgets sync or async? - Added by Wim Dumon about 3 years ago

Hi,

Not sure how exactly you define sync vs async in this context, but be sure to read on the mechanism we use for server push. The reference documentation of WApplication::enableUpdates() contains extra information, and some examples also demonstrate the concept (search for enableUpdates() in the examples directory).

Wim.

RE: Widgets sync or async? - Added by Txt Only about 3 years ago

Thanks for your reply. I'll check these out.
I just want to know how much latency should I expect with 'setChecked()' and other actions, milliseconds? microseconds? or nanoseconds?

RE: Widgets sync or async? - Added by Wim Dumon about 3 years ago

Never measured it that accurately, and in reality the answer is 'it depends'. For normal cases (so not applications with unreasonable amounts of widgets), I would expect order of magnitude milliseconds (1-100?), not in the least due to network delay.

RE: Widgets sync or async? - Added by Txt Only about 3 years ago

Thanks again.

Seems I should test it myself.
I kind of hope it's much less than milliseconds, and 100ms is certainly not acceptable.

    (1-6/6)