From: Sean Kinsey on
On Apr 8, 5:45 pm, Antony Scriven <adscri...(a)gmail.com> wrote:
> On Apr 8, 4:24 pm, Scott Sauyet wrote:
>
>  > [... about automatic log out ...]
>  >
>  > [...] Sean understands that a server-side solution is the
>  > only completely reliable one, that he is using a
>  > client-side solution to improve the user's experience
>  > when possible. [...]
>  >
>  > The solution he suggests above goes further than your
>  > original suggestion, though, by modifying (on page
>  > unload) the server-side timeout to a much shorter period.
>  > I don't know how well the solution will work.  It strikes
>  > me as a bad idea for a browser to allow *any* HTTP
>  > requests inside the page unload, but I know that
>  > window.open(url) does work so maybe a synchronous XHR
>  > request will too.
>
> Synchronous requests don't tend to improve the user's
> experience. --Antony

Generalizing with 'blocking the ui thread is bad and therefor
synchronous xhr is bad, so this approach MUST be bad' is just silly.
In this case it is proven exactly the opposite.
Since the result of the synchronous xhr is an improved user experience
then it can be deducted that using a synchronous xhr in onload (for
this scenario) actually does improve the user experience.

I do not generalize and say that all use of synchronous xhr improves
ux (now that would also be silly), just that _in this case_ it
actually does.

From: Antony Scriven on
On Apr 9, 9:51 am, Sean Kinsey wrote:

> [...]
>
> Generalizing with 'blocking the ui thread is bad and
> therefor synchronous xhr is bad, so this approach MUST be
> bad' is just silly. In this case it is proven exactly the
> opposite.

How?

> Since the result of the synchronous xhr is an improved
> user experience then it can be deducted that using
> a synchronous xhr in onload (for this scenario) actually
> does improve the user experience.

What happens if your app is open in two windows? --Antony
From: Jorge on
On Apr 9, 10:26 am, Antony Scriven <adscri...(a)gmail.com> wrote:
> On Apr 8, 9:37 pm, Jorge wrote:
>
>  > On Apr 8, 10:18 pm, Antony Scriven <adscri...(a)gmail.com> wrote:
>  >
>  > > On Apr 8, 7:00 pm, Jorge wrote:
>  > > > On Apr 8, 5:45 pm, Antony Scriven <adscri...(a)gmail.com> wrote:
>  >
>  > > > > Synchronous requests don't tend to improve the user's
>  > > > > experience. --Antony
>  > > >
>  > > > But onunload you can't do an asynchronous XHR.
>  >
>  > > I wasn't talking about asynchronous XHR. --Antony
>  >
>  > But any other attempt to fetch an additional resource onunload
> might
>  > fail. I.e. an <img>. E.g. in Safari.
>
> Don't do that either. --Antony

So, what do you propose to ping the server from onunload ?
--
Jorge.
From: Sean Kinsey on
On Apr 9, 11:13 am, Antony Scriven <adscri...(a)gmail.com> wrote:
> On Apr 9, 9:51 am, Sean Kinsey wrote:
>
>  > [...]
>  >
>  > Generalizing with 'blocking the ui thread is bad and
>  > therefor synchronous xhr is bad, so this approach MUST be
>  > bad' is just silly. In this case it is proven exactly the
>  > opposite.
>
> How?

Read the thread...

>
>  > Since the result of the synchronous xhr is an improved
>  > user experience then it can be deducted that using
>  > a synchronous xhr in onload (for this scenario) actually
>  > does improve the user experience.
>
> What happens if your app is open in two windows? --Antony

That has not been covered here, but for our application that is not
possible within the same browser and so does not need to be accounted
for.


From: Antony Scriven on
On Apr 9, 10:23 am, Sean Kinsey wrote:

> On Apr 9, 11:13 am, Antony Scriven <adscri...(a)gmail.com>
> wrote:
>
> > On Apr 9, 9:51 am, Sean Kinsey wrote:
>
> > > [...]
> > >
> > > Generalizing with 'blocking the ui thread is bad and
> > > therefor synchronous xhr is bad, so this approach
> > > MUST be bad' is just silly. In this case it is proven
> > > exactly the opposite.
>
> > How?
>
> Read the thread...

`Read the thread...' really means `I don't have any real
proof but I'm hoping you'll get lost reading the thread and
aren't going to notice.'

> > > Since the result of the synchronous xhr is an
> > > improved user experience then it can be deducted that
> > > using a synchronous xhr in onload (for this scenario)
> > > actually does improve the user experience.
>
> > What happens if your app is open in two windows?
> > --Antony
>
> That has not been covered here, but for our application
> that is not possible within the same browser and so does
> not need to be accounted for.

And what happens when you upgrade? --Antony