Skip to content

Chat sample: User-created rooms at runtime #98

@pathosDev

Description

@pathosDev

Followup from the chat sample (`examples/chat/`). The current sample
hardcodes the room list in `shared/rooms.ts`; this issue tracks
making rooms dynamic.

Approach

Replace `DEFAULT_ROOMS` with a DistributedData-backed registry:

```ts
const ROOMS_KEY = 'chat.rooms';
dd.update<ORSet>(ROOMS_KEY, () => ORSet.empty(), s => s.add(replicaId, name));
```

Protocol additions

```ts
type ClientMessage = ... | { type: 'create-room', name: string };
type ServerMessage = ... | { type: 'room-added', name: string }
| { type: 'room-removed', name: string };
```

UI

  • "+ New room" button in the rooms panel.
  • Subscribe to ORSet changes → push `room-added`/`room-removed` to all clients.

Out of scope (followup)

  • Per-room access control (private rooms).
  • Room deletion + history archival.

Source: `examples/chat/` README → "Out of scope" section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: lowNice-to-have / niche / demand-driven

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions