You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by JumpStart <ge...@gmail.com> on 2016/05/03 10:52:47 UTC

Detect and warn of poor internet connection

Has anyone tried modifying Tapestry’s client-side portion to detect a poor internet connection and, perhaps, pop up a dialog? I need it for a Tapestry app that’s used on mobile devices.

I’m thinking that when there’s a page request or component event request, the javascript could send a “ping” request to the server-side, with a timeout of, say, 1 second.

- If the “ping” request times out, then the javascript could pop up a dialog explaining that the internet connection is currently unreliable. The dialog would have only one button: OK. The page request or component event request will not be sent.

- Otherwise (i.e. the “ping” request succeeds), the javascript would proceed as normal (i.e. sends the page request or component event request).

Of course the internet connection could still degrade while the page request or component event request is in progress but, in the environments this app will be used, the probability of this is low if the “ping” test has succeeded immediately before it.

Geoff
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Detect and warn of poor internet connection

Posted by Felix Gonschorek <fe...@netzgut.net>.
Hi Geoff,

the application we are using Offline.js with is still running on Tapestry
5.3 and it has a "special" mix of Tapestry Backend and Angular JS Mobile
Frontend. I am not sure if i can help you with the specifics to get
Offline.js working with requireJs / Tapestry 5.4. I remember faintly we
implemented recurring checks for connectivity with
setTimeout(checkConnectivity, 3000) and checkConnectivity calls Offline.js,
shows/hides an "you are offline" banner and re-sets the timeout for calling
itself or somehting like that... But it's two or three years ago i worked
on that, so i am not sure.

Felix


2016-05-16 10:50 GMT+02:00 JumpStart <ge...@gmail.com>:

> Hi Felix,
>
> Offline.js is looking really promising - it does the connection detection
> well - but I’m finding that it often leaves out the UI - it often doesn’t
> render the div that has class “offline-ui".
>
> I’m using T5.4, and offline is being loaded by RequireJS because I've
> shimmed it in AppModule. Was that a mistake? Are you using T5.4?
>
> Geoff
>
> > On 7 May 2016, at 12:09 PM, JumpStart <
> geoff.callender.jumpstart@gmail.com> wrote:
> >
> > Thank you Felix. I will look into that.
> >
> >> On 3 May 2016, at 5:43 PM, Felix Gonschorek <fe...@netzgut.net> wrote:
> >>
> >> HI Geoff,
> >>
> >> we successfuly used Offline ( https://github.com/hubspot/offline ) to
> >> support that in our apps.
> >>
> >> Cheers
> >> Felix
> >>
> >> 2016-05-03 10:52 GMT+02:00 JumpStart <
> geoff.callender.jumpstart@gmail.com>:
> >>
> >>> Has anyone tried modifying Tapestry’s client-side portion to detect a
> poor
> >>> internet connection and, perhaps, pop up a dialog? I need it for a
> Tapestry
> >>> app that’s used on mobile devices.
> >>>
> >>> I’m thinking that when there’s a page request or component event
> request,
> >>> the javascript could send a “ping” request to the server-side, with a
> >>> timeout of, say, 1 second.
> >>>
> >>> - If the “ping” request times out, then the javascript could pop up a
> >>> dialog explaining that the internet connection is currently
> unreliable. The
> >>> dialog would have only one button: OK. The page request or component
> event
> >>> request will not be sent.
> >>>
> >>> - Otherwise (i.e. the “ping” request succeeds), the javascript would
> >>> proceed as normal (i.e. sends the page request or component event
> request).
> >>>
> >>> Of course the internet connection could still degrade while the page
> >>> request or component event request is in progress but, in the
> environments
> >>> this app will be used, the probability of this is low if the “ping”
> test
> >>> has succeeded immediately before it.
> >>>
> >>> Geoff
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>
> >>>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Detect and warn of poor internet connection

Posted by JumpStart <ge...@gmail.com>.
Hi Felix,

Offline.js is looking really promising - it does the connection detection well - but I’m finding that it often leaves out the UI - it often doesn’t render the div that has class “offline-ui". 

I’m using T5.4, and offline is being loaded by RequireJS because I've shimmed it in AppModule. Was that a mistake? Are you using T5.4?

Geoff

> On 7 May 2016, at 12:09 PM, JumpStart <ge...@gmail.com> wrote:
> 
> Thank you Felix. I will look into that.
> 
>> On 3 May 2016, at 5:43 PM, Felix Gonschorek <fe...@netzgut.net> wrote:
>> 
>> HI Geoff,
>> 
>> we successfuly used Offline ( https://github.com/hubspot/offline ) to
>> support that in our apps.
>> 
>> Cheers
>> Felix
>> 
>> 2016-05-03 10:52 GMT+02:00 JumpStart <ge...@gmail.com>:
>> 
>>> Has anyone tried modifying Tapestry’s client-side portion to detect a poor
>>> internet connection and, perhaps, pop up a dialog? I need it for a Tapestry
>>> app that’s used on mobile devices.
>>> 
>>> I’m thinking that when there’s a page request or component event request,
>>> the javascript could send a “ping” request to the server-side, with a
>>> timeout of, say, 1 second.
>>> 
>>> - If the “ping” request times out, then the javascript could pop up a
>>> dialog explaining that the internet connection is currently unreliable. The
>>> dialog would have only one button: OK. The page request or component event
>>> request will not be sent.
>>> 
>>> - Otherwise (i.e. the “ping” request succeeds), the javascript would
>>> proceed as normal (i.e. sends the page request or component event request).
>>> 
>>> Of course the internet connection could still degrade while the page
>>> request or component event request is in progress but, in the environments
>>> this app will be used, the probability of this is low if the “ping” test
>>> has succeeded immediately before it.
>>> 
>>> Geoff
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>> 
>>> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Detect and warn of poor internet connection

Posted by JumpStart <ge...@gmail.com>.
Thank you Felix. I will look into that.

> On 3 May 2016, at 5:43 PM, Felix Gonschorek <fe...@netzgut.net> wrote:
> 
> HI Geoff,
> 
> we successfuly used Offline ( https://github.com/hubspot/offline ) to
> support that in our apps.
> 
> Cheers
> Felix
> 
> 2016-05-03 10:52 GMT+02:00 JumpStart <ge...@gmail.com>:
> 
>> Has anyone tried modifying Tapestry’s client-side portion to detect a poor
>> internet connection and, perhaps, pop up a dialog? I need it for a Tapestry
>> app that’s used on mobile devices.
>> 
>> I’m thinking that when there’s a page request or component event request,
>> the javascript could send a “ping” request to the server-side, with a
>> timeout of, say, 1 second.
>> 
>> - If the “ping” request times out, then the javascript could pop up a
>> dialog explaining that the internet connection is currently unreliable. The
>> dialog would have only one button: OK. The page request or component event
>> request will not be sent.
>> 
>> - Otherwise (i.e. the “ping” request succeeds), the javascript would
>> proceed as normal (i.e. sends the page request or component event request).
>> 
>> Of course the internet connection could still degrade while the page
>> request or component event request is in progress but, in the environments
>> this app will be used, the probability of this is low if the “ping” test
>> has succeeded immediately before it.
>> 
>> Geoff
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Detect and warn of poor internet connection

Posted by Felix Gonschorek <fe...@netzgut.net>.
HI Geoff,

we successfuly used Offline ( https://github.com/hubspot/offline ) to
support that in our apps.

Cheers
Felix

2016-05-03 10:52 GMT+02:00 JumpStart <ge...@gmail.com>:

> Has anyone tried modifying Tapestry’s client-side portion to detect a poor
> internet connection and, perhaps, pop up a dialog? I need it for a Tapestry
> app that’s used on mobile devices.
>
> I’m thinking that when there’s a page request or component event request,
> the javascript could send a “ping” request to the server-side, with a
> timeout of, say, 1 second.
>
> - If the “ping” request times out, then the javascript could pop up a
> dialog explaining that the internet connection is currently unreliable. The
> dialog would have only one button: OK. The page request or component event
> request will not be sent.
>
> - Otherwise (i.e. the “ping” request succeeds), the javascript would
> proceed as normal (i.e. sends the page request or component event request).
>
> Of course the internet connection could still degrade while the page
> request or component event request is in progress but, in the environments
> this app will be used, the probability of this is low if the “ping” test
> has succeeded immediately before it.
>
> Geoff
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>