Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
service worker does not send any data after 1 minute

I'm in the process of creating my first PWA and testing around a lot. This is a driver app for my boss. Now I'm at a point where I can't really get any further. If the app is running in the background, the location and current speed should continue to be sent. Location and speed are not a problem and the data is also sent to the server.

The big problem is the service worker. I have already read many posts on the Internet that it is possible to continue sending the data with a service worker, even if the app is running in the background. Unfortunately, this doesn't last long. After about 1 minute it stops sending this data and I don't know why. Perhaps someone from you can give me a tip as to why this is the case. My service worker isn't that big either

Javascript:

document.addEventListener ("DOMContentLoaded", function () {
if ('serviceWorker' in navigator) {
    navigator.serviceWorker.register ('/ js / sw.js', {scope: '/ js /'}). then (function (reg) {
        console.log ('Registration Successful');
    }). catch (function (error) {
        console.log ('Registration failed with' + error);
    });
};

});

The function SaveSpeerd2F () is in the file sw.js and contains the query of the position and the current speed and then sends this via Jquery Ajax to the server with a time interval of 5 seconds. As already said, it stops sending data after about 1 minute and I don't really know why. Mehr zu diesem Ausgangstext Für weitere Übersetzungsinformationen ist ein Ausgangstext erforderlich Feedback geben Seitenleisten

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!