Damien
November 15, 2026, 3:20pm
1
On my iPhone 15, running the latest version of iOS, I added the Gladys web app to my home screen.
Everything works, but if I leave the web app for a few minutes, when I reopen Gladys, I get pages like these:
The problem is that the data never arrives. I have to close the web app from the multitasking menu and reopen it.
Do you have any ideas?
Thanks
Hi Damien,
Thanks for the feedback and screenshots, that’s very helpful!
I looked into it and I think I found the cause: when iOS puts the web app in the background, it cuts its connection. Requests that were in progress at that moment (or sent right after returning to the app) then remain blocked indefinitely. Just a few blocked requests are enough for all subsequent ones to wait behind, hence the infinite loading until you close the app.
I opened a GitHub issue to track the subject: Gladys Plus: data never loads after resuming the iOS web app from background (requests hang until the app is killed) · Issue #3387 · GladysAssistant/Gladys · GitHub
In the meantime, the only workaround is to close and reopen the web app, sorry for the inconvenience!
Hi everyone!
This topic is now in development .
A PR has been opened to prevent Gladys Plus calls from getting stuck after a connection drop (the infinite spinner when returning to the iOS app):
master ← claude/elegant-hamilton-o3uydu
opened 01:12PM - 16 Nov 26 UTC
### Description
With Gladys Plus, every API call travels through the socket of … the Gateway. A call whose answer was lost (the socket closed while the call was in flight) never settled: it kept its slot in the 5-call limiter and its entry in the GET dedup cache, so a handful of them froze every later call until the app was reloaded. A phone that freezes the web app in the background and kills its socket does exactly that, which is the infinite spinner reported on iOS.
**`front/src/utils/GatewayHttpClient.js`**
- Calls in flight are rejected as soon as the session dispatches the disconnection (right before socket.io drops their acknowledgements), so the limiter slot and the GET cache entry are always released.
- A call lost with its connection is sent again once the connection is back, up to 3 attempts, but only when that is harmless: a GET, or a call that never left the browser (it was still waiting for its limiter slot). A POST / PATCH / DELETE that was sent fails with `GATEWAY_CONNECTION_LOST` instead of being replayed.
- Safety timeout of 60 s on a call that was sent (`GATEWAY_REQUEST_TIMEOUT`), for an answer lost on a connection that stays up. Before failing, it asks the session to check the connection.
- Calls made while disconnected wait for the connection for 30 s at most (`GATEWAY_CONNECTION_TIMEOUT`) instead of forever, so a mutating call is never executed long after the user asked for it.
- Errors keep the existing `{ response: { status, data } }` shape.
**`front/src/utils/GatewaySession.js`**
- `ready` goes back to `false` on disconnection and to `true` once the socket is authenticated again, so calls are no longer emitted on a socket that cannot carry them.
- `checkConnection()`: pings the Gateway (`calculateLatency`, 5 s) and re-opens the socket when it does not answer. It runs when the app comes back to the foreground after 5 s or more in the background, and calls made while it runs wait for its verdict. It ends at once if the socket notices the disconnection by itself, and does nothing on a session that is logged out.
- The same check recovers a socket that reconnected but could not authenticate (the access token is fetched over HTTP, and nothing retried it before the next connection).
**Two deliberate differences with the proposal in the issue**
- The safety timeout is 60 s rather than ~30 s. It is only the net for an answer lost on a live connection (a closed connection ends its calls immediately), so I left room for slow endpoints such as device discovery or uploads on a mobile uplink. It is one constant if you prefer 30 s.
- Coming back to the foreground does not force a data refresh when the connection check succeeds: a socket that is still alive delivered every event sent in the meantime. When the connection had to be re-established, the usual `websocket.connected` dispatch makes the dashboard boxes reload, as before.
**How it was verified**
There is no front unit-test runner and Cypress does not cover Gladys Plus mode, so I drove the real `GatewaySession` / `GatewayHttpClient` (served by Vite in gateway mode, real `socket.io-client`) from Chromium against a fake socket.io Gateway behind a TCP proxy that can drop packets silently or kill connections. Only the encryption and the two HTTP calls of the Gateway client were stubbed. The harness is not part of this PR.
| Scenario | `master` | This branch |
|---|---|---|
| 8 GETs + 1 POST emitted on a dead connection, then network back (the reproduction steps of the issue) | Everything stays pending forever, including calls made after the reconnection | All answered after the reconnection; each call executed once |
| Connection killed with calls in flight | not run | GETs sent again and answered; the POST in flight fails with `GATEWAY_CONNECTION_LOST` and is executed once; POSTs not yet sent go through after the reconnection |
| Back to the foreground on a dead connection (default 25 s + 20 s pings) | not run | Detected in 5 s instead of up to 45 s; the GET and the POST made on return are answered once |
| Back to the foreground on a healthy connection | not run | No reconnection, calls answered normally |
| Answers that never come on a live connection (5 GETs) | not run | Fail after 60 s, the call queued behind them goes through, no reconnection |
| Socket reconnected but authentication failed | not run | Waiting calls fail after 30 s, the socket is re-opened and later calls work |
Not verified: a real iPhone, and the real Gateway server. In particular I assumed the Gateway answers the `latency` event on an authenticated user socket, as the issue suggests.
**Follow-up outside this repository**
`@gladysassistant/gladys-gateway-js` could use `socket.timeout(ms).emit(...)` in `sendMessageGladys`, and retry the authentication when fetching the access token fails in its `connect` handler. Neither is required for this fix.
### Related request
Closes #3387
Forum: https://community.gladysassistant.com/t/lag-multitache-ios/11587
### Checklist
- [x] If a forum topic or GitHub issue exists, the description links it (`Forum: https://community.gladysassistant.com/t/...` or `Closes #...`)
- [ ] Tests pass: `cd server && npm run coverage` (Codecov requires 100% coverage on changed lines) and Cypress (`npm run cypress:run`) if the UI changed — not run locally: the server is untouched, and the two changed files are only instantiated in Gladys Plus mode, which Cypress does not exercise. `npm run build` passes.
- [x] Linter and prettier pass on both front and server (`npm run eslint`, `npm run prettier`) — run on `front/`, the only directory touched
- [x] No undocumented breaking change
---
_Generated by [Claude Code](https://claude.ai/code/session_01MNjB36qqdPk1qjXSHV9CcU)_
Feel free to follow the PR, test (optional, especially for small requests), and share your feedback here if needed.
Hello,
The lag of the iOS web app after going to the background (pending Gladys Plus calls) has been fixed in Gladys Assistant 5.3.4 .
The details are in the announcement:
Hi everyone!
Gladys Assistant 5.3.4 is out
Last week, 5.3.3 rebuilt the dashboard and the scenes for the phone. This release finishes the job: the rest of Gladys gets its phone layout, from the sign-in page to the energy contract wizard, by way of every device page. On a computer, the layouts stay the same.
[The Zigbee2MQTT devices, the page of a device and a map zone, on a phone]
All of Gladys, on your phone
the page of a device: name and room first, then one row per…