Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep ajax request running if client get disconnected for a few seconds #112

Open
misner opened this issue Jun 6, 2016 · 0 comments
Open

Comments

@misner
Copy link

misner commented Jun 6, 2016

I am using ajax:

var msg;
msg = Messenger().run({
  action: $.ajax,
  progressMessage:  'Loading the RESULT...',
  successMessage:  'This is the Result : %{results  and all}',
   actions: {
      getMoreDetails: {
        label: "give me details on the provided result",
        action: function() {
          ....//do stuff
        }
      },
      goToNextResult: {
        label: 'Move To Next Result',
        action: function(){
         //do stuff
        }       
      }
    }
});

So the user while online clicks a button and a modal appears with the message 'Loading the Result'.

Then if for any reason, the user's mobile loses internet connection (can happen often...ex: subway tunnel :) instead of trying to maintain the request (at last a few seconds to see if user might gets re-connected again), the modal disappears of the screen.

On console I see the error:
GET http://localhost:3000/deals/deal5/ net::ERR_INTERNET_DISCONNECTED

How can I do the following: online user triggers ajax request then his device gets disconnected but the modal stays on the screen (for max 10 seconds) and then display results if it gets it within the 10 sec. If not it show a message like 'osrry we did not get the results, check your internet connection' ?

Can I do it with Messenger or do I need to use add offline.js (also by hubspot) to messenger.js and coordinate the two ?

@misner misner changed the title Keep trying request if client get disconnected for a few seconds Keep ajax request running if client get disconnected for a few seconds Jun 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant