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

159
Views
Safari y Chrome en IOS no escuchan los eventos enviados por el servidor cuando el navegador está en segundo plano

Estoy tratando de redirigir mi aplicación web Angular a una URL diferente que recibe de los eventos enviados por el servidor . Esta característica funciona bien cuando el navegador está en primer plano en IOS. Sin embargo, cuando un usuario cambia el navegador al fondo, la aplicación Angular no escucha ningún evento .

Este problema solo ocurre en IOS . En Andriod, los navegadores reciben eventos enviados por el servidor incluso cuando el navegador está en segundo plano.

servicio.ts

 getServerSentEvent(merchantTransactionId: string, txnDate: string): Observable<any> { return new Observable<string>(obs => { const appType = 'guest-checkout'; const url = environment.BASE_DATA_URL + '/api/event/server-sent/event/subscribe/' + appType + '/' + merchantTransactionId; const es = new EventSource(url); es.addEventListener('message', (event) => { // alert(event.data); obs.next(event.data); }); return () => es.close(); }); }

He añadido un cuadro de alerta para probar si aparece en el móvil o no. No aparece cuando el navegador está en segundo plano. Además, probé onmessage en lugar de addEventListener y no hubo cambios.

componente.ts

 triggerSSEEvent(merchantTxnId, txnDateString): void { this.sseService.getServerSentEvent(merchantTxnId, txnDateString).subscribe( (data) => { const response = JSON.parse(data); this.responseURL = response.url; window.location.href = response.url; }, (error) => { this.showError(); } ); }

Nota: el usuario generalmente cambia el navegador para aceptar la solicitud de inserción de otra aplicación.

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!