EventSource: event 'error' not fired in iOS18

Hi, I noticed that event 'error' from EventSource is not fired in latest iOS 18, when web application is minimized and then re-activated. This was working in previous versions, so it is probably regression bug.

Behavior in iOS 17: PWA application has active SSE/EventSource connection with server. Then some other application becomes active for more then ≈20 sec, so that SSE connection is closed. After SSE connection is closed, application is opened again. When application becomes visible, 'error' event is fired. This is expected behavior and this way also works on other non-iOS systems.

Behavior in iOS 18: Following same steps as before it looks like that error event is not fired. Also,readyState of EventSource is 1 (EventSource.OPEN ), even if SSE connection is closed.

If connection is interrupted when application is in foreground, then error event is fired on both iOS versions.

This is quite problematic, because previously you could rely on 'error' event to trigger reconnection, when application becomes visible, but now this is not possible. Also EventSource readyState is 1, even if there is no connection to the server, so it is in wrong state.

Any thoughts?

I am experiencing the same problem and I’m now even thinking about replacing SSE with web sockets. This is affecting our production applications.

Have you devised a workaround?

I’ve also logged an issue with Apple, but there’s been no follow up.

EventSource: event 'error' not fired in iOS18
 
 
Q