Non WebTimer on Web 2

A couple of curly ones tonight?

I understand that the new WebTimer is handy for client side UI updates etc, what I want though is a working Server side timer like the old timer was in Web 1.0.

What I’m trying to achieve is to run a command on the server every x seconds. It appears I can create the old style timer but it doesn’t ever seem to fire (tested with a simple message box)

Am I missing something obvious?
Thanks again all!

You’ve got that backwards.

The WebTimer in Web 1.0 was client side only.

WebTimer in Web 2 can be either client or server based (there’s an option in the inspector for it). Client side runs in the browser and sends an event to the server each time it fires. Server side runs in the app. The advantage now is that it is session-aware.

1 Like

Thanks Greg,
I think the problem is that I’d pulled the timer across from a Web1.0 project and it didn’t populate the option in the inspector. Seems like I’m all good now!

Can you clarify the benefits of server side v’s client side?

The client side has the benefit of not requiring server resources until it’s fired. The downside is that each time they fire, the app on the server has to deal with a request.

The server WebTimer can be run at a much higher frequency though. It’s basically a regular timer which has access to the session in which it was created, so if you place it on a page or container, its events still fire on the main thread (at this time anyway).

So system resources vs traffic.

Greg, should Timer.callLater work anywhere as a delay to call a subroutine anywhere in a project? ie, if called from within a dataAvailable event, should it still remain in scope and fire xx mS later even after the event is completed? I think I have overlap / workarounds with two of my current cases seemingly similar.

1 Like

Timer.CallLater will fire on the main thread, so you’ll need to keep track of the session it came from and create your own WebSessionContext for that.