Reconnect from a WebApp possible?

Forgot to mention, you can just paste the above code into the “HTMLHeader” field in the inspector for the App object.

[quote=337459:@John Joyce]The following will reload the page if the disconnected message is showing.
It checks every 5 seconds, you can change that using a different setInterval.
I only tried this on Safari - your mileage may vary.

[code]

[/code][/quote]
John, that’s awesome! I’ll give it a spin and some testing tomorrow! Kudos!

Just made a quick test and it seems to work just fine. Safari, Firefox and Chrome all reconnect when disconnected.
Have to do some more thorough testing of course :slight_smile:

[quote=337459:@John Joyce]The following will reload the page if the disconnected message is showing.
It checks every 5 seconds, you can change that using a different setInterval.
I only tried this on Safari - your mileage may vary.

[code]

[/code][/quote]
If you are going to do this, I suggest that you hook into the Disconnect event in the WebSDK. That way you don’t need to run that timer until the browser actually disconnects.

Xojo.addListener("XojoSession", "disconnect", disconnectMethod);

[quote=337554:@Greg O’Lone]If you are going to do this, I suggest that you hook into the Disconnect event in the WebSDK. That way you don’t need to run that timer until the browser actually disconnects.

Xojo.addListener("XojoSession", "disconnect", disconnectMethod);

That would be nice!
Have never used the websdk yet :slight_smile:

I’d love to learn how to use the WebSDK too. Maybe this could be an XDC session? Show how to implement that idea and make a control?

WebSDK.pdf in the Websdk folder starts with a very simple example about how to create a WebSDK control. It is real easy.

to everybody interested in this topic, I’d like to highlight that <https://xojo.com/issue/45332> just yesterday changed its state to ‘Implemented’. Thanks Greg! I’m happily looking forward to the next release.

Interesting. I wonder what was implemented. The “Reload” button or automatic reconnection?
Anyway. I’m stuck in 2013r33…

Because of this issue???

Haha, no. It’s a sort of money(priority) issue :wink:
There’s no such thing as a “new-born-at-home” free upgrade is there? Could be a thing! hint, hint

This is fantastic! Thank you Greg!!!

Who wouldn’t want to reconnect? Just reload it for the user:

location.reload();

[quote=338019:@neoesum neoesum]Who wouldn’t want to reconnect? Just reload it for the user:

location.reload();[/quote]

Neoesum, or whoever is hiding between that handle, if I may, you don’t seem to know very much about Xojo Web. That JS command will not reload the page, but restart the app and create a new session in Xojo Web. Besides, the disconnect we refer to here, is a feature of Xojo Web which disconnects the session after the user has been idle for some time, or lost connection on a mobile.

Or even when Safari decides that the user has been idle for too long and closes the connection for no reason…or the server is simply restarted, or the app has been updated. There are many situations where that disconnect message will appear that would benefit from an automatic reload(or a reload button(not hacked in using JS.)) :slight_smile:

Well … The way Xojo Web disconnect works, the page is already loaded when the app starts. So it should be possible to put a reload button in there.
But for people like you who have ancient versions, the hack is a sensible solution.

^^ ancient version peeps always causin’ the troubles @Albin Kiland :wink:

[quote=338108:@Michel Bujardet]So it should be possible to put a reload button in there.
But for people like you who have ancient versions, the hack is a sensible solution.[/quote]
I know. And Johns solution for automatic reconnect does work. Even though it looks for the disconnect message every x seconds, all the time. :slight_smile:

And a “Click here to reload” button does work too. Just not as fancy :wink:

Now I FEEL OLD too. And I’m only 32 :stuck_out_tongue:

2013R3.3 was a very nice version, though. Not recent bells and whistle, but stable and fair.