How you get rid of "We are having trouble communicating with the server. Please wait a moment while we attempt to reconnect."

So far on MacOS only, but I will need Windows as well, and I did tried Native and as well WebKit, same issue .

Cómo me deshago de ese mensaje, porque no está reintentando, si le vuelvo a dar refrescar a mi navegador lo carga bien, o sea que el ping deberia responder, pero por si solo no lo hace y el cartel queda trancando la app.

No puedes. Ese cuadro de diálogo significa que el explorador tiene problemas para comunicarse con la aplicación. El front-end da 5 segundos e intenta volver a conectarse a la sesión del usuario. Si no puede, el navegador se desconecta.

¿Ha cambiado el valor de Application.SessionTimeout?

No, depende de ese valor, puedo controlarlo por ahi?.
Puedo enviarlo a otra URL ?

No ayudaría enviarlo a otra url. Es el socket de comunicación en segundo plano para esa sesión en particular.

Creo que tenemos una solicitud de característica para agregar un enlace al cuadro de diálogo de desconexión.

Disculpe mi español, estoy usando Microsoft Translate.

@Greg_O_Lone muchas gracias y aprecio el esfuerzo en español, aguardo entonces alguna solución.

Aquí se ve el caso en la app showcase de @Javier_Menendez donde si se pasa a otra app y se vuelve al movil al seleccionar un item no vuelve a reintentar.

Ah, sí. Javier cambió el texto en la propia sesión. Si selecciona Sesión en el Navegador, el texto de estos elementos se puede editar en el inspector

@Greg_O_Lone I talked with @Mauricio_Tanco about the message, the problem is that if you go to showcase.xojo.com then go to the mail app and return to the Safari browser, you will see the dialog about trying to reconnect but that never happens. We need to Reload the page to make it active again.

Can you look into this? This is the only website that shows this behavior so new Xojo users or the clients of Xojo users will not know why this is different than any other website and will complain that “it is not working”.

I just duplicate this behavior on my Android phone, I did exactly what Mauricio said, open Chrome, load showcase.xojo.com go to Mail app, read an email or two, come back to Chrome and you get this screen

Can something be done so when we load a Xojo web application using the phone, go to other application (mail for example) and return to the browser the page reloads again without the user hitting reload?

Thank you.

Ah, that issue.

So the problem is that to save energy, browsers on phones don’t let JavaScript just run in the background indefinitely. I’d have to check, but my suspicion is that the sockets get terminated when the browser is pushed to the background and that there’s a finite amount of time that the app is allowed to continue running. We’ll have to see if there is a way to restart things when it comes forward again.

4 Likes

You could try putting this (from this thread) in Session.Opening:

var exec() as String
exec.Add( "setInterval(function() {" )
exec.Add( "  if ($('#dialog_disconnect').length > 0 || $('#dialog_reconnect').length > 0) {" )
exec.add( "    $.ajax({url : window.location.href}).done(function(data, statusText, xhr) {" )
exec.add( "      if (xhr.status == 200) setTimeout(function() {location.reload();},10000);" )
exec.Add( "    });" )
exec.Add( "  }" )
exec.Add( "}, 10000);" )
ExecuteJavaScript( String.FromArray( exec, "" ) )

Others have been using it successfully. When it detects that the disconnect or reconnect modals are shown, it waits 10 seconds between checks to see if the connection is restored, then reloads the page when it is.

3 Likes

Muchas gracias, funcionó! así es como se debería de comportar por el mensaje que muestra ( “intentando reconectar”), cosa que ahora hace.

Por otro lado estaría bueno revisar porque en el móvil si abandono el navegador y paso a otra aplicación, al volver provoca esa pérdida de conexión, pero por ahora sirve, nuevamente muchas gracias!.

1 Like

Happy to help.

Does it preserve the current session or discard it (and the session vars)?

Anthony’s workaround will reload the page. The user will receive a new session.

1 Like

So it will restart the app engine from the zero after this hiccup. The user must detect such case, handle it and start over. The continuity will be lost. I wish we had a way to recover, reconnect the session, and continue; if we were in a certain window of time after losing it. So in my case, instead of a reload, I should adapt Anthony’s code and send the user directly to the login page of the app.

1 Like

MITO !!!

i faced the same issue with 2021r1
but there was also updates at android phone in the meantime.

Ignore, added wrong code …

Hello, I keep trying to find a solution to the disconnection by leaving the browser on the mobile, what I notice is that if I return the disconnection message does not appear right away and if in those seconds I make a “request” for data it works fine and then yes I get the poster, doubt? so he hadn’t actually been disconnected yet ?!
@Greg_O_Lone
have you found any solution for that issue?

Right, so on mobile, the JavaScript engine pauses when the browser app is sent to the background. When you come back, it takes a moment for JavaScript to restart but all of the timers that keep track of the connections have to fire again to get a bead on when the last communication from the server was. If you take an action I the app, it will appear to work on the client, but the server connection is most likely gone already.