Chat Room multiplayer
Chat with other visitors in the Lobby room, or switch rooms in the list. Each room is a custom scope built with Scope::build(), and your username is a SESSION signal.
Scope::build().onCleanup hook removes its user from the room's list.chat.db, and the view loads the last 50 on every render.withWorkerNum().Signals
username
string session scope Persists across tabs. Same identity whether you switch rooms or open new tabs.
messageInput
string tab scope initial: empty string Current message draft. Private to this tab.
typingIndicator
array custom scope Custom room scope. Who is typing and when that expires. Shows "User is typing..." to everyone in the same room until the server clears it.
Actions
sendMessage
Appends message to the room, clears input, clears the sender's typing indicator, and broadcasts to room.
updateTyping
Sets the typing indicator with username and broadcasts to room. The server clears it 5 s after the last keystroke.
Views
chat_room.html.twig
Sidebar room list + chat panel with message list, user presence, and typing indicator. Uses onCleanup for cleanup.