Examples menu

๐Ÿ’ฌ Chat Room

Chat: Random

Custom scopes isolate each room. Messages in "lobby" never leak to "general" โ€” each room has its own broadcast channel built with Scope::build().
Session-scoped usernames persist across tabs. Your username is stored in SESSION scope, so switching rooms or opening a new tab keeps the same identity.
Presence + typing indicators update in real time. When a user disconnects, the onDisconnect hook removes them from the room's user list.
addScope() lets a context join a broadcast channel mid-flight. The room page starts in TAB scope for private input, then adds the room scope for shared messages.
SQLite persistence keeps message history across server restarts. Each room's messages are stored in chat.db and the last 50 are loaded on connect โ€” no in-memory state required.
Multi-room architecture โ€” open two rooms side by side. Each room's scope is independent, so typing in Lobby has no effect on General.
Random
UserF888 (you)
User6161 01:34:30
ๅ•Š
KeenLynx 01:51:04
222
UserF7F1 17:37:39
kljhlhkj
UserF7F1 17:37:41
hkjlkjh
Unknown 17:37:45
hello?
Unknown 17:37:49
w
Unknown 17:37:54
why am i unknown suddenly?
Unknown 17:38:00
i am known now?
Unknown 17:38:01
now
UserF7F1 17:38:03
ee
UserF7F1 17:38:04
e
UserF7F1 17:38:05
e
UserF7F1 17:38:07
thats odd
Unknown 17:38:08
its all me
Unknown 17:38:12
hmm
Unknown 17:38:14
fuck
Unknown 17:38:15
kjshdfjkhasfkj
Unknown 17:38:24
<h1>foo</h1>

โšก Signals

username string SESSION

Persists across tabs. Same identity whether you switch rooms or open new tabs.

messageInput string TAB ""

Current message draft. Private to this tab.

typingIndicator string Custom

Custom room scope. Shows "User is typing..." to everyone in the same room.

๐ŸŽฏ Actions

sendMessage

Appends message to the room, clears input, resets typing indicator, and broadcasts to room.

updateTyping

Sets the typing indicator with username and broadcasts to room.

๐Ÿ‘ Views

chat_room.html.twig

Sidebar room list + chat panel with message list, user presence, and typing indicator. Uses onDisconnect for cleanup.