Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #35518

Re: fetch with beforeunload

Newsgroups comp.lang.javascript
Date 2018-08-18 02:56 -0700
References <Ds2dnT5p55vPg-jGnZ2dnUU7-WvNnZ2d@westnet.com.au> <6c489ac1-baa6-4283-a905-c09d39cac0f1@googlegroups.com> <zJGdnTqxYZzO0uvGnZ2dnUU7-VnNnZ2d@westnet.com.au> <9738a2eb-4b17-41d7-9a88-2fda1102e4c6@googlegroups.com> <BIadnadNp_n-ferGnZ2dnUU7-NmdnZ2d@westnet.com.au>
Message-ID <fb5ae1dc-1bfc-43c8-b325-9ddac4a400f7@googlegroups.com> (permalink)
Subject Re: fetch with beforeunload
From Julio Di Egidio <julio@diegidio.name>

Show all headers | View raw


On Saturday, 18 August 2018 11:01:34 UTC+2, Andrew Poulos  wrote:
> On 17/08/2018 9:18 PM, Julio Di Egidio wrote:
> > On Friday, 17 August 2018 06:30:22 UTC+2, Andrew Poulos  wrote:
> > 
> >> So is the issue that I can't know if whatever I've set to run in
> >> beforeunload will actually run?
> > 
> > Yes, not just asynchronous jobs, the browser or the OS could even just crash:
> > that's why for anything critical you'd use a different approach, e.g. polling.
> 
> Hmm, so even using navigator.sendBeacon is no guarantee of success.

Or simply the Internet could go down...

Rather, in engineering the only guarantee is *guarantee of failure* (Murphy's
Law), and a discipline to handle it: which itself is not about guarantees (this
ain't mathematics),  it's about margins and cost-benefits, in reliability
just as in security and so on.  (E.g. the civil engineer who designs a bridge
calculates minimum material to do the job then, as by law, at least doubles
it, to have more *margin* of safety not any guarantee in any strong sense;
or the fact that one has to take three backups in three different places for important information: not even that is a guarantee in the strong sense, but
it's still good enough to beat the chances and as experience confirms.  And so
on: I suggest a good software engineering book to those who are serious about
programming/software development...)

So you rather start from your requirements and work to cover just those and
at a level of reliability and security and so on that is "economical" all
requirements, explicit and implicit, considered (and so far you have said
nothing about your requirements, which is why you just get a quick overview
of the usual possible approaches).

That said, in the usual web scenario, when the web application (server-side)
goes down, all games are in stand-by anyway, hence the problem (mostly) reduces
to just the problem of the client-side being essentially unreliable.  Hence you
rather use server sessions or, for more sophisticated needs, polling, etc.

HTH,

Julio

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

fetch with beforeunload Andrew Poulos <ap_prog@hotmail.com> - 2018-08-16 16:48 +1000
  Re: fetch with beforeunload Julio Di Egidio <julio@diegidio.name> - 2018-08-16 04:46 -0700
    Re: fetch with beforeunload Andrew Poulos <ap_prog@hotmail.com> - 2018-08-17 14:30 +1000
      Re: fetch with beforeunload Julio Di Egidio <julio@diegidio.name> - 2018-08-17 04:18 -0700
        Re: fetch with beforeunload Andrew Poulos <ap_prog@hotmail.com> - 2018-08-18 19:01 +1000
          Re: fetch with beforeunload Julio Di Egidio <julio@diegidio.name> - 2018-08-18 02:56 -0700
      Re: fetch with beforeunload Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-08-29 22:26 +0200
  Re: fetch with beforeunload "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-08-16 13:18 -0700
    Re: fetch with beforeunload Julio Di Egidio <julio@diegidio.name> - 2018-08-16 13:44 -0700
      Re: fetch with beforeunload "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-08-16 14:28 -0700
        Re: fetch with beforeunload Julio Di Egidio <julio@diegidio.name> - 2018-08-16 14:36 -0700
          Re: fetch with beforeunload "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-08-16 15:32 -0700
          Re: fetch with beforeunload John G Harris <niam@jghnorth.org.uk.invalid> - 2018-08-17 10:46 +0100
            Re: fetch with beforeunload Julio Di Egidio <julio@diegidio.name> - 2018-08-17 04:12 -0700

csiph-web