Hello,
I am developing some mobile applications that will have a offline mode, when a connection is not available. It works great when i toggle off the network, the unit switches to my new offline routine. However, when i test by dropping the connection, the unit acts as if it is loading. It does not swap directly to the offline mode.
My question is how does pui.onoffline work. Why would it get held up when simulating dropping from a network? Why does it work smoothly when going into the units settings and toggling network off?
Thanks.
pui.onoffline
-
- Profound User
- Posts: 45
- Joined: Tue Mar 11, 2014 2:50 pm
- First Name: William
- Last Name: Negley
- Company Name: Utz Quality Foods
- Contact:
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: pui.onoffline
When you submit a screen back to the RPG program, Profound UI uses an AJAX request to send the screen data back to the handler. If an error occurs when sending that screen, it will call pui.onoffline() (if defined). Basically, any time it can't send a request to the server, it calls this routine. That's the only way Profound UI can know if you are/aren't connected to the server.
If you toggle off the network, then your device knows it's not possible to send a request since there's no network. Therefore, it will immediately fail, and therefore pui.onoffline() gets called immediately.
If you drop the connection in other ways, however, the browser may not know that it's not connected. In this case, it has to send the request and wait for it to time out -- otherwise it doesn't know that it's been disconnected. So in that case, you may have to wait before pui.onoffline() is called.
If you toggle off the network, then your device knows it's not possible to send a request since there's no network. Therefore, it will immediately fail, and therefore pui.onoffline() gets called immediately.
If you drop the connection in other ways, however, the browser may not know that it's not connected. In this case, it has to send the request and wait for it to time out -- otherwise it doesn't know that it's been disconnected. So in that case, you may have to wait before pui.onoffline() is called.
Who is online
Users browsing this forum: No registered users and 1 guest