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


Groups > comp.lang.javascript > #35502

Re: fetch with beforeunload

Newsgroups comp.lang.javascript
Date 2018-08-16 13:18 -0700
References <Ds2dnT5p55vPg-jGnZ2dnUU7-WvNnZ2d@westnet.com.au>
Message-ID <0357cdad-38ed-4bf3-935c-26d41fac9726@googlegroups.com> (permalink)
Subject Re: fetch with beforeunload
From "Michael Haufe (TNO)" <tno@thenewobjective.com>

Show all headers | View raw


Andrew Poulos wrote:
> When the use leaves the page I need to tell the server (send a token - 
> short string) so that the server can do some cleaning up.
> [...]
> Sometimes the server receives the token and sometimes not. Is there a 
> reliable way to do this?

Generally not in the way you are approaching it as you can not prevent the user from closing a tab, nor the window, nor from turning off the computer, and only limited control over navigation.

One possible approach as an alternative is to periodically send a heartbeat to the server letting it know the client is still active, then once the heartbeed stops you assume the client is dead and do cleanup.

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