I’m using SSE (Server-Sent Events) in an Android app with OkHttp. After 5 minutes of idle time, the connection stops receiving data on mobile networks, but works fine on WiFi. No errors or callbacks are triggered, and the connection appears to remain open.
I’m already using the Connection: keep-alive and keep-alive headers in OkHttp, but it still fails on mobile networks. The only solution I’ve found is pinging the server every minute, but I’m looking for a more efficient way to keep the connection alive.
Has anyone encountered this issue or found a better solution for keeping the SSE connection alive on mobile networks?