We are running into an issue updating the PTT service status when our app is in the background.
In one of your earlier responses you mentioned that keeping the PTT connection alive in the background is common:
"...is actually pretty common to most PTT apps, as it helps keep the conversation stream live/current compared to relying entirely on PTT pushes."
However, what we are currently observing is different.
When the debugger is not attached, it appears that all tasks are immediately suspended once the app goes to the background. When the app returns to the foreground, the URLSessionWebSocketTask fails with:
Domain: NSPOSIXErrorDomain
Code: 53
This effectively means we must immediately fall back to push notifications whenever the app backgrounds. While this works, it is not ideal.
The larger issue is that this failure is only detected after the app resumes, which means we cannot update the service status on PTChannelManager while the app is still in the background.
This leads to two different UI behaviors in the PTT interface:
Case 1: Connection active when entering background
The PTT UI still allows pressing the Talk button.
Pressing Talk triggers a reconnect, which works.
Case 2: Network lost before entering background and later restored
The PTT UI remains disabled (e.g. the Talk button stays disabled).
The service status is only corrected after reopening the app.
From your earlier response, I understood that some background activity to keep the conversation stream current should be possible.
If background work is not allowed in this situation, I would expect the app to be woken when the PTT Dynamic Island UI is opened so it can refresh the service status and update the Talk button state.
Are we missing something in how background modes should be configured for PTT apps, or is this the expected behavior for WebSocket connections used with Push-to-Talk?
Thanks!