-
-
Notifications
You must be signed in to change notification settings - Fork 37
Description
What were you trying to do?
When a NativePHP mobile app plays audio in the background (via a native audio plugin), the OS (Android/iOS) may kill the PHP runtime to reclaim memory. The native audio layer continues playing because it runs outside the PHP process, but the embedded WebView's Livewire components lose their backend.
When any Livewire component attempts a request (e.g., PlaybackProgressUpdated, deferred component load, or user interaction), it hits the dead PHP runtime and receives a 404 response from /livewire-{hash}/update. The WebView then displays an error page, and the app is stuck in a broken state until the user force-kills and
restarts the app.
Actual behavior
- Livewire requests return 404 because the PHP runtime is dead
- The WebView renders an error page (or Livewire's error modal)
- No automatic recovery mechanism exists
- The app remains in a broken state until force-killed
Any idea or workaround for this ??
What happened?
When the OS kills and reinitializes the PHP runtime, the app should gracefully recover:
How to reproduce the bug
- Create a NativePHP mobile app with a Livewire component that uses the native background mode
- Start for example audio playback
- Background the app (press Home / switch to another app)
- Wait for the OS to kill the PHP runtime (happens faster on Android with memory pressure, or can be simulated via Android Studio's "Terminate Application" in the process list)
- While audio continues playing in the background, observe that Livewire requests fail with 404
- Return to the app — the WebView shows an error page instead of the UI
Debug Output
Environment
- NativePHP Mobile: ^3.0
- Laravel: 12.x
- Livewire: 4.x
- PHP: 8.5
- Tested on: Android (emulator & device), iOS (simulator)
Which operating systems have you seen this occur on?
No response
Which platforms were you trying to build for?
No response
Notes
No response