Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

195
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda