Session.webtimer does not fire

We have a limitation within ISP that causes our web applications connectivity to go bad.

In order to keep the HTTPS live we need to send a small amount of data to the server

Our first idea was to put a timer in the session class that fires off a trivial request

But we cannot get web timer to run in the session. It simply does not fire

We could put it on every single page but that is a really ugly workaround.

This appears at first glance to be a bug but I wanted to throw to the community before I reported it.

my understanding of web timers is that the need to be in the browser. The session isn’t in the browser.

web timers fire in the browser and call back to the server, not the other way around.

It seems like you’re going to need to find a way to put it on every page

It is possible to use Timer (not webtimer).

Timer is server side. We need to warm the ISP connection by sending data between browser and server.

Your Xojo program itself is server side.

Now, if you really want to nag the server from the browser, WebTimer won’t do the trick, as it’s action event remains server side.

You should use a JavaScript.

According to docs: “WebTimer is part of the page”
I don’t know why you think that action event remains server side for the WebTimer.

The JS idea is good, but still require to change every page. Which is not what we are looking for. And it is not clear how is safe for the xojo itself this idea. It can break some browser-server communication.

Perhaps there is other way exists?

[quote=278110:@Kirill Pekarov]According to docs: “WebTimer is part of the page”
I don’t know why you think that action event remains server side for the WebTimer. [/quote]

Think about it some more. Where does ANY Xojo code executes ?

The WebTimer is client side, but there is no way to execute Xojo code on the client. So what WebTimer does is trigger the event on the server.

Once again, think about it : how do you expect anything to execute in the browser if not part of a page ?

Then WebTimer is what we need. It sends data from browser to server to fire the action code.

Is it possible to use one WebTimer for all pages?

It can be another way. Like running a timer from server and sends some data to each session, like:

 For i as Integer = 0 to App.SessionCount-1
    App.SessionAtIndex(i).MsgBox("People! We're shutting down!")
  next

Found it here

But without interrupting an user. I’ve tried to set COOKIES, but it works only after user action, like page change.

What do you want to achieve ?

Wrote above.
“We need to warm the ISP connection by sending data between browser and server.”

We have an ISP which, as we assume, closes the connection very fast. So Xojo Web app works very unstable.

[quote=278113:@Kirill Pekarov]Then WebTimer is what we need. It sends data from browser to server to fire the action code.

Is it possible to use one WebTimer for all pages?[/quote]
maybe. Remember that you must implement the Action event though, even if it’s just by AddHandler. If you don’t, no data is sent.

  • Drag a new WebPage to your project
  • Call it WebPageTemplate
  • Drag a WebTimer onto it
  • Implement the Action event
  • If necessary, put some code in there. Something like dim s as string
  • Set all pages with Super WebPageTemplate

The WebTimer will automatically be included in all pages.

Thank you! Looks like it works.

As I remember Xojo has problems with page inheritance, I’m surprised it works in Web.