Send world/item UI metadata in welcome and consume on client
This commit is contained in:
@@ -18,7 +18,7 @@ This is a behavior guide for packet semantics beyond raw schemas.
|
||||
|
||||
## Server -> Client
|
||||
|
||||
- `welcome`: initial snapshot with users/items.
|
||||
- `welcome`: initial snapshot with users/items plus server UI/world metadata.
|
||||
- `signal`: forwarded WebRTC offer/answer/ICE.
|
||||
- `update_position`, `update_nickname`, `user_left`: presence updates.
|
||||
- `chat_message`: system and user chat stream.
|
||||
@@ -35,6 +35,17 @@ This is a behavior guide for packet semantics beyond raw schemas.
|
||||
- `item_action_result` messages are intended for direct screen-reader/user status feedback.
|
||||
- `item_use_sound` contains absolute item world coordinates (`x`, `y`) and sound path.
|
||||
|
||||
## Welcome Metadata
|
||||
|
||||
- `welcome.worldConfig.gridSize`: server-authoritative grid size used by clients for bounds/drawing.
|
||||
- `welcome.uiDefinitions`: server-provided item UI definitions:
|
||||
- `itemTypeOrder`: add-item menu order
|
||||
- `itemTypes[].editableProperties`: editable property keys by item type
|
||||
- `itemTypes[].propertyOptions`: menu options for property keys (for example clock `timeZone`)
|
||||
- `itemTypes[].globalProperties`: non-editable global values (`useSound`, `emitSound`, `useCooldownMs`)
|
||||
|
||||
- Clients keep local fallback defaults but should prefer server-provided metadata when present.
|
||||
|
||||
## Validation Boundaries
|
||||
|
||||
- Server is authoritative for all action validation and normalization.
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
3. Client connects signaling websocket.
|
||||
4. Server sends `welcome` with users/items snapshot.
|
||||
5. Client:
|
||||
- applies `welcome.worldConfig.gridSize` for authoritative grid bounds/rendering
|
||||
- applies `welcome.uiDefinitions` for item menus/properties/options
|
||||
- sends initial `update_position`
|
||||
- sends initial `update_nickname`
|
||||
- creates peer runtimes for known users
|
||||
|
||||
Reference in New Issue
Block a user