fix: e2e failures on the device: edit replies before their events, /ws closed on reboot

- runModelEdit sent an edit's events (room, roomRemoved, the orders,
  repeaters) before its reply, where PROTOCOL.md says they follow it. A
  client waiting for the reply read past them (test_adding_and_deleting_a_room).
- A restart dropped the /ws connections without a close, so clients never
  saw them go (test_reboot). ESPNetwork::end() now closes them too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cjkas 2026-10-25 12:43:06 +01:00
parent 72e99d14c5
commit 330d8fa0de
4 changed files with 8 additions and 1 deletions

View file

@ -415,6 +415,7 @@ void ProtoSocket::begin(AsyncWebServer &server) {
ws.onEvent(ProtoSocket::wsEvent);
server.addHandler(&ws);
}
void ProtoSocket::end() { ws.closeAll(1001, "Restarting"); }
bool ProtoSocket::hasClients() const {
for(const proto_slot_t &s : slots)
if(s.clientId.load()) return true;