net: auto-reload on server version mismatch and announce connected version on welcome

This commit is contained in:
Jage9
2026-02-22 18:40:26 -05:00
parent ee0b98290e
commit d5dbb8289a
4 changed files with 31 additions and 5 deletions

View File

@@ -62,5 +62,6 @@ This is a behavior guide for packet semantics beyond raw schemas.
- Client sends automatic heartbeat `ping` packets every 10 seconds while connected.
- Heartbeat pings use negative `clientSentAt` ids and are internal (not user-visible ping status).
- If a heartbeat `pong` is missed for one interval (10 seconds), client force-disconnects and reconnects.
- After reconnect, if `welcome.serverInfo.instanceId` changed, client announces:
`Server restarted, version <version>.`
- After reconnect, if `welcome.serverInfo.instanceId` changed, client announces `Server restarted.`
- Client emits `Connected. Version <version>.` after each `welcome`.
- If `welcome.serverInfo.version` differs from running client version, client auto-reloads.

View File

@@ -9,6 +9,7 @@
5. Client:
- applies `welcome.worldConfig.gridSize` for authoritative grid bounds/rendering
- records `welcome.serverInfo` (`instanceId`, `version`) for restart detection
- if `welcome.serverInfo.version` differs from running client version, auto-reloads the page
- applies `welcome.uiDefinitions` for item menus/properties/options
- sends initial `update_position`
- sends initial `update_nickname`
@@ -48,7 +49,8 @@ Core incoming message effects:
- While running, client sends heartbeat `ping` every 10 seconds.
- If one heartbeat `pong` is missed (10-second interval), client auto-reconnects.
- If reconnect lands on a different `welcome.serverInfo.instanceId`, client announces server restart/version.
- If reconnect lands on a different `welcome.serverInfo.instanceId`, client announces server restart.
- Connect/reconnect status message is emitted from `welcome` and includes server version.
## Disconnect/Cleanup