Build a team chat
Try the finished chat in this tab, then build it in nine steps, each a program you can run.
npm install @tinyactors/node@tinyactors/node 0.4.0, 19 November 2026What changedNode.js and Bun guide
Chat as any of six people
Each person and channel is an actor in this tab, and you are forager: switch person from your avatar's menu. The debugger at the top right cuts a person's connection or switches the running chat between steps 5 and 9.
A team chat, The Hill, with channels, direct messages and six people, each an actor; you are forager, and your avatar's menu signs you out or switches person. Its debugger runs the simulated clock, loses a person's connection, makes a screen drop or delay messages, runs scenarios, shows each actor's chart in its current state and a log, and moves the running chat between the tutorial's steps 5 and 9 by live migration.
1. Create a room
A room is an actor with a list of members: join adds to it, and post sends to all of them. The text leaves the chart as a message to chat:client, which your program handles.
<state id="open">
<transition event="join">
<assign location="members" expr="members.concat([_event.data.user])"/>
</transition>
<transition event="post">
<send type="chat:client" event="message">
<param name="to" expr="members"/>
<param name="from" expr="_event.data.user"/>
<param name="text" expr="_event.data.text"/>
</send>
</transition>
</state>Here a Client prints what each member's screen would show. The program starts a room and sends it two joins and a post.
// The client processor stands in for the users' screens.
class Client {
lines = [];
receive(send) {
for (const user of send.data.to) this.lines.push(`${user} sees ${send.data.from}: ${send.data.text}`);
}
}const room = host.spawn('room', { name: 'general' });
room.send('join', { user: 'ada' });
room.send('join', { user: 'bob' });
room.send('post', { user: 'ada', text: 'hi' });
await host.idle();ada sees ada: hi
bob sees ada: hi2. Track who is online
A user who stops typing sends no event, so nothing marks them away. The user's chart restarts a 300-second timer on each activity, and when it fires, the chart moves to away.
<state id="online" initial="active">
<transition event="disconnect" target="offline"/>
<transition event="message">
<send type="chat:client" event="message">
<param name="to" expr="name"/>
<param name="from" expr="_event.data.from"/>
<param name="text" expr="_event.data.text"/>
</send>
</transition>
<state id="active">
<onentry>
<send type="chat:client" event="status">
<param name="user" expr="name"/>
<param name="status" expr="'active'"/>
</send>
<send id="idle" event="idle" delay="300s"/>
</onentry>
<onexit><cancel sendid="idle"/></onexit>
<transition event="activity"> <!-- no target: the state stays, the timer starts again -->
<cancel sendid="idle"/>
<send id="idle" event="idle" delay="300s"/>
</transition>
<transition event="idle" target="away"/>
</state>
<state id="away">
<onentry>
<send type="chat:client" event="status">
<param name="user" expr="name"/>
<param name="status" expr="'away'"/>
</send>
</onentry>
<transition event="activity" target="active"/>
</state>
</state>The room now sends each post to each member's user actor, by its name. A user who is offline ignores it.
<transition event="post">
<foreach array="members" item="member">
<send targetexpr="'tinyactors://chat/@user.' + member" event="message">
<param name="from" expr="_event.data.user"/>
<param name="text" expr="_event.data.text"/>
</send>
</foreach>
</transition>A simulated clock moves 300 seconds in no time, so the program sees both users go away.
client.lines.push('-- 300 seconds pass');
clock.increment(300_000);
await host.idle();
client.lines.push('-- bob types, ada closes the app');
host.actor('user.bob').send('activity');
host.actor('user.ada').send('disconnect');
room.send('post', { user: 'bob', text: 'anyone?' });
await host.idle();ada is offline
bob is offline
ada is active
bob is active
-- 300 seconds pass
ada is away
bob is away
-- bob types, ada closes the app
bob is active
ada is offline
bob sees bob: anyone?3. Create each room once
Two users who create general at the same moment could get two rooms. One workspace actor creates every room with a spawn send and records the name at once, so a repeat is refused.
<state id="ready">
<!-- The name joins rooms when the spawn is sent: a second room.create
for it may come before the Spawner answers, and it is refused. -->
<transition event="room.create" cond="refusal(rooms, _event.data.name) === null">
<send type="spawn" event="spawn" idlocation="sendid">
<param name="chart" expr="'room'"/>
<param name="name" expr="'room.' + _event.data.name"/>
<param name="params" expr="({ name: _event.data.name })"/>
</send>
<assign location="rooms" expr="rooms.concat([_event.data.name])"/>
<assign location="creating[sendid]" expr="({ name: _event.data.name, by: _event.origin })"/>
</transition>
<transition event="room.create">
<send targetexpr="_event.origin" event="room.refused">
<param name="name" expr="_event.data.name"/>
<param name="reason" expr="refusal(rooms, _event.data.name)"/>
</send>
</transition>
<!-- the Spawner answers by the sendid of the spawn -->
<transition event="spawned" cond="_event.sendid in creating">
<send targetexpr="creating[_event.sendid].by" event="room.created">
<param name="name" expr="creating[_event.sendid].name"/>
</send>
<script>delete creating[_event.sendid];</script>
</transition>A user joins a room by its name. A join sent to a room that does not exist comes back to the user as error.communication.
<transition event="join">
<send id="join" targetexpr="'tinyactors://chat/@room.' + _event.data.room" event="join">
<param name="user" expr="name"/>
</send>
<raise event="activity"/>
</transition>
<transition event="joined">
<send type="chat:client" event="joined">
<param name="to" expr="name"/>
<param name="room" expr="_event.data.room"/>
</send>
</transition>
<transition event="error.communication" cond="_event.sendid === 'join'">
<send type="chat:client" event="error">
<param name="to" expr="name"/>
<param name="reason" expr="'no such room'"/>
</send>
</transition>With actor.ask, the program requests general twice and two invalid names; then bob joins a room that does not exist.
for (const name of ['general', 'general', 'Bad Name', '-']) {
const [event, data] = await workspace.ask('room.create', { name });
client.lines.push(`create ${name}: ${event}${data.reason ? ` (${data.reason})` : ''}`);
}
const [, { rooms }] = await workspace.ask('rooms.list');
client.lines.push(`rooms: ${rooms.join(', ')}`);
ada.send('join', { room: 'general' });
bob.send('join', { room: 'general' });
bob.send('join', { room: 'random' });create general: room.created
create general: room.refused (exists)
create Bad Name: room.refused (invalid name)
create -: room.refused (invalid name)
rooms: general
ada joined general
bob gets an error: no such room
bob joined general
ada sees ada in general: hi
bob sees ada in general: hi4. Show everyone who is online
A user who connects late has missed every status change made before. Each user now reports its status to the workspace, which keeps them all.
<transition event="status">
<assign location="arriving" expr="cameOnline(roster, _event)"/>
<assign location="roster[_event.data.user]" expr="_event.data.status"/>
<if cond="arriving">
<send targetexpr="_event.origin" event="roster">
<param name="roster" expr="roster"/>
</send>
</if>
<foreach array="online(roster, _event.data.user)" item="user">
<send targetexpr="'tinyactors://chat/@user.' + user" event="roster.update">
<content expr="_event.data"/>
</send>
</foreach>
</transition>A newcomer gets the whole roster, and each user online gets every change after that.
-- ada connects
ada sees the roster: ada active, bob offline, cat offline
-- bob connects
bob sees the roster: ada active, bob active, cat offline
ada sees bob is active
-- 300 seconds pass
bob sees ada is away
ada sees bob is away
-- bob closes the app
ada sees bob is offline
the workspace answers: {"ada":"away","bob":"offline","cat":"offline"}5. Keep idle users out of memory
Most users sit idle, yet each one's actor stays in memory. Give the host a store and a resident bound, and actors past the bound wait in the store.
const host = new Host(compiled, {
system: 'chat',
clock,
store,
resident,
ioProcessors: { 'chat:client': client, spawn: new Spawner() },
...options,
});1000 users spawned: 1002 actors, 50 in memory, 952 in the store
100 users connect and join general: 1002 actors, 50 in memory, 952 in the store
u0 posts: 1002 actors, 50 in memory, 952 in the store
100 messages reached the screens
300 seconds pass: 1002 actors, 50 in memory, 952 in the store
14850 roster updates reached the screens
the store saved 1156 blobs and loaded 204
at most 50 actors were in memory at restThe charts are step 4's: an event, or a user's 300-second timer, loads a saved actor again.
6. Show who is typing
A notice for every key would flood every screen. The user's chart tells its room at most once every 3 seconds, on a timer of its own.
<!-- this user types: the room hears of it at most once every 3 seconds -->
<transition event="typing" cond="!(_event.data.room in quiet)">
<send targetexpr="'tinyactors://chat/@room.' + _event.data.room" event="typing">
<param name="user" expr="name"/>
</send>
<send event="quiet.over" delay="3s" idlocation="timer">
<param name="room" expr="_event.data.room"/>
</send>
<assign location="quiet[_event.data.room]" expr="timer"/>
<raise event="activity"/>
</transition>
<transition event="typing">
<raise event="activity"/>
</transition>
<transition event="quiet.over">
<script>delete quiet[_event.data.room];</script>
</transition>Each other member's chart shows the notice for 5 seconds after the last one, restarting its timer on each.
<!-- another member types: the screen shows it until 5 seconds after the last notice -->
<transition event="others.typing">
<if cond="(_event.data.room + ' ' + _event.data.user) in typers">
<cancel sendidexpr="typers[_event.data.room + ' ' + _event.data.user].id"/>
<else/>
<send type="chat:client" event="typing">
<param name="to" expr="name"/>
<param name="room" expr="_event.data.room"/>
<param name="user" expr="_event.data.user"/>
</send>
</if>
<send event="indicator.expired" delay="5s" idlocation="timer">
<param name="room" expr="_event.data.room"/>
<param name="user" expr="_event.data.user"/>
</send>
<assign location="typers[_event.data.room + ' ' + _event.data.user]"
expr="({ id: timer, room: _event.data.room, user: _event.data.user })"/>
</transition>
<transition event="indicator.expired">
<script>delete typers[_event.data.room + ' ' + _event.data.user];</script>
<send type="chat:client" event="typing.stopped">
<param name="to" expr="name"/>
<param name="room" expr="_event.data.room"/>
<param name="user" expr="_event.data.user"/>
</send>
</transition>A post takes the typist's notice off every screen, so it ends the typist's 3 seconds too. The first key after a post is told at once.
<transition event="post">
<send targetexpr="'tinyactors://chat/@room.' + _event.data.room" event="post">
<param name="user" expr="name"/>
<param name="text" expr="_event.data.text"/>
</send>
<!-- the post ends this user's indicator on every screen, so the next key is told at once -->
<if cond="_event.data.room in quiet">
<cancel sendidexpr="quiet[_event.data.room]"/>
<script>delete quiet[_event.data.room];</script>
</if>
<raise event="activity"/>
</transition>When its user disconnects, the chart cancels its timers and takes each notice off the user's screen.
<onexit>
<!-- this user's screen stops showing who is typing, and the timers go -->
<foreach array="Object.values(typers)" item="typer">
<cancel sendidexpr="typer.id"/>
<send type="chat:client" event="typing.stopped">
<param name="to" expr="name"/>
<param name="room" expr="typer.room"/>
<param name="user" expr="typer.user"/>
</send>
</foreach>
<assign location="typers" expr="({})"/>
<foreach array="Object.values(quiet)" item="over">
<cancel sendidexpr="over"/>
</foreach>
<assign location="quiet" expr="({})"/>
</onexit>Ada's three keys make one notice, and bob's notice runs out by itself. Cat's disconnect takes bob's notice off cat's screen, and ada's key right after a post shows at once.
client.lines.push('-- ada types three keys');
for (let key = 0; key < 3; key++) ada.send('typing', { room: 'general' });
await host.idle();
client.lines.push('-- 4 seconds pass, ada types and posts');
clock.increment(4_000);
ada.send('typing', { room: 'general' });
await host.idle();
ada.send('post', { room: 'general', text: 'lunch?' });
await host.idle();
client.lines.push('-- bob types, then stops for 6 seconds');
bob.send('typing', { room: 'general' });
await host.idle();
clock.increment(6_000);
await host.idle();
client.lines.push('-- bob types again, then cat disconnects');
bob.send('typing', { room: 'general' });
await host.idle();
host.actor('user.cat').send('disconnect');
await host.idle();
client.lines.push('-- ada types, posts and types again at once');
ada.send('typing', { room: 'general' });
await host.idle();
ada.send('post', { room: 'general', text: 'pizza?' });
await host.idle();
ada.send('typing', { room: 'general' });
await host.idle();
-- ada types three keys
bob sees ada typing in general
cat sees ada typing in general
-- 4 seconds pass, ada types and posts
ada sees ada in general: lunch?
bob sees ada stop typing in general
cat sees ada stop typing in general
bob sees ada in general: lunch?
cat sees ada in general: lunch?
-- bob types, then stops for 6 seconds
ada sees bob typing in general
cat sees bob typing in general
ada sees bob stop typing in general
cat sees bob stop typing in general
-- bob types again, then cat disconnects
ada sees bob typing in general
cat sees bob typing in general
cat sees bob stop typing in general
-- ada types, posts and types again at once
bob sees ada typing in general
ada sees ada in general: pizza?
bob sees ada stop typing in general
bob sees ada in general: pizza?
bob sees ada typing in general7. Ride out a lost connection
A phone in a tunnel loses its connection for a few seconds, and until now its user went offline at once. Now the user's chart reports away, as Slack shows it, and keeps new messages for 30 seconds in reconnecting.
<state id="reconnecting">
<onentry>
<!-- the others see the user as away at once -->
<send target="tinyactors://chat/@workspace" event="status">
<param name="user" expr="name"/>
<param name="status" expr="'away'"/>
</send>
<send id="grace" event="grace.over" delay="30s"/>
</onentry>
<onexit><cancel sendid="grace"/></onexit>
<!-- back: resume enters active or away, whose entry reports the status;
"reconnected" comes after it -->
<transition event="connect" target="resume">
<raise event="reconnected"/>
</transition>
<transition event="disconnect" target="offline"/>
<transition event="grace.over" target="offline"/>
<transition event="message">
<assign location="held" expr="held.concat([{ room: _event.data.room, from: _event.data.from, text: _event.data.text }])"/>
</transition>
</state>Back within 30 seconds, the history state resume returns the user to active or away, whose entry reports that status again. The held messages reach the screen, and the raised reconnected asks the workspace for the roster once the status is out.
<state id="online" initial="active">
<onentry>
<!-- back from a lost connection: the messages that came meanwhile -->
<foreach array="held" item="message">
<send type="chat:client" event="message">
<param name="to" expr="name"/>
<param name="room" expr="message.room"/>
<param name="from" expr="message.from"/>
<param name="text" expr="message.text"/>
</send>
</foreach>
<assign location="held" expr="[]"/>
</onentry>
<onexit>
<!-- this user's screen stops showing who is typing, and the timers go -->
<foreach array="Object.values(typers)" item="typer">
<cancel sendidexpr="typer.id"/>
<send type="chat:client" event="typing.stopped">
<param name="to" expr="name"/>
<param name="room" expr="typer.room"/>
<param name="user" expr="typer.user"/>
</send>
</foreach>
<assign location="typers" expr="({})"/>
<foreach array="Object.values(quiet)" item="over">
<cancel sendidexpr="over"/>
</foreach>
<assign location="quiet" expr="({})"/>
</onexit>
<history id="resume"> <!-- active or away, as before the connection was lost -->
<transition target="active"/>
</history>
<transition event="disconnect" target="offline"/>
<transition event="connection.lost" target="reconnecting"/>
<!-- back from a lost connection, once resume has reported the status again:
the screen missed the roster's changes, so the workspace sends it whole -->
<transition event="reconnected">
<send target="tinyactors://chat/@workspace" event="roster.get"/>
</transition>Ada sees bob away, then active 10 seconds later; he gets the held message and a roster with cy offline. Then he is gone for 40 seconds: only the second loss makes him offline.
client.lines.push('-- bob enters a tunnel, cy signs out, ada posts');
bob.send('connection.lost');
await host.idle();
cy.send('disconnect');
await host.idle();
ada.send('post', { room: 'general', text: 'where are you?' });
await host.idle();
client.lines.push('-- 10 seconds later bob is back');
clock.increment(10_000);
bob.send('connect');
await host.idle();
client.lines.push('-- bob loses the connection for 40 seconds');
bob.send('connection.lost');
await host.idle();
clock.increment(40_000);
await host.idle();
ada.send('post', { room: 'general', text: 'gone?' });
await host.idle();-- bob enters a tunnel, cy signs out, ada posts
ada sees bob is away
cy sees bob is away
ada sees cy is offline
ada sees ada in general: where are you?
-- 10 seconds later bob is back
bob sees ada in general: where are you?
ada sees bob is active
bob sees the roster: ada active, bob active, cy offline
-- bob loses the connection for 40 seconds
ada sees bob is away
ada sees bob is offline
ada sees ada in general: gone?8. Show a room's history to late joiners
A member who joins late saw nothing said before, and a member who joined twice got every post twice. A channel's history is data your program stores; the room sends each post to the store, which numbers and times it.
<transition event="post">
<!-- the store numbers and times the post and answers "appended"; if it fails
the send, this room gets error.communication and the post is lost -->
<send type="chat:history" event="append">
<param name="room" expr="name"/>
<param name="from" expr="_event.data.user"/>
<param name="text" expr="_event.data.text"/>
</send>
</transition>
<transition event="appended">
<foreach array="members" item="member">
<send targetexpr="'tinyactors://chat/@user.' + member" event="message">
<param name="seq" expr="_event.data.seq"/>
<param name="at" expr="_event.data.at"/>
<param name="room" expr="name"/>
<param name="from" expr="_event.data.from"/>
<param name="text" expr="_event.data.text"/>
</send>
</foreach>
</transition>The store is an I/O processor of your program. It numbers and times each post, so a screen shows when it was posted, however late it arrives.
// The channels' history: data the application stores, one list of posts a
// channel. The room chart sends each post here (chat:history); the store
// numbers it, records when it was made by the clock it is given, keeps it
// and answers `appended` with both, which the room puts on the post it
// sends each member. The numbers count per channel, as a channel's posts
// are read together, and never start again: the store, not an actor, holds
// the count. A screen shows a post's own time, however late the post
// reaches it, and reads a channel's latest posts when it joins. A real
// store is a table in a database.
export class History {
posts = new Map(); // room -> [{ seq, at, from, text }]
constructor(clock) {
this.clock = clock;
}
receive(send) {
const { room, from, text } = send.data;
if (!this.posts.has(room)) this.posts.set(room, []);
const posts = this.posts.get(room);
const seq = posts.length + 1;
const at = this.clock.now; // milliseconds
posts.push({ seq, at, from, text });
send.answer('appended', { seq, at, room, from, text });
}
/** The latest `limit` posts of `room`. */
read(room, limit = 50) {
return (this.posts.get(room) ?? []).slice(-limit);
}
}A join adds the member only once, and answers joined so the screen reads the store.
<transition event="join">
<if cond="!members.includes(_event.data.user)">
<assign location="members" expr="members.concat([_event.data.user])"/>
</if>
<send targetexpr="_event.origin" event="joined">
<param name="room" expr="name"/>
</send>
</transition>A member who signs out misses the posts made meanwhile: the room sends them, but an offline user drops them. When the connection opens, the screen reads what it lacks from the store.
/** `user`'s connection opens: for each room joined, the screen reads the posts it lacks. */
opened(user) {
for (const room of this.rooms.get(user) ?? []) {
const posts = this.history.read(room).filter((post) => !this.shown.has(`${user} ${room} ${post.seq}`));
if (posts.length === 0) continue;
for (const post of posts) this.shown.add(`${user} ${room} ${post.seq}`);
this.lines.push(`${user} connects and reads in ${room}: ${posts.map(said).join(' | ')}`);
}
}Cat joins after two posts and reads both; bob joins a second time, and the third post reaches him once. Cat signs out for the fourth post and reads it five minutes later, stamped with the time bob posted it.
clock.increment(90_000);
client.lines.push('-- cat joins late, bob joins again');
cat.send('join', { room: 'general' });
bob.send('join', { room: 'general' });
await host.idle();
ada.send('post', { room: 'general', text: 'welcome, cat' });
await host.idle();
client.lines.push('-- cat signs out, and back in five minutes later');
cat.send('disconnect');
await host.idle();
clock.increment(60_000);
bob.send('post', { room: 'general', text: 'lunch at noon' });
await host.idle();
clock.increment(300_000);
client.opened('cat'); // cat's connection opens: the screen catches up,
cat.send('connect'); // then cat's actor hears of it
await host.idle();-- ada and bob join and talk
ada joins general and reads nothing yet
bob joins general and reads nothing yet
ada sees post 1 from ada at 0:00: hi bob
bob sees post 1 from ada at 0:00: hi bob
ada sees post 2 from bob at 0:30: hi ada
bob sees post 2 from bob at 0:30: hi ada
-- cat joins late, bob joins again
cat joins general and reads ada at 0:00: hi bob | bob at 0:30: hi ada
bob joins general and reads ada at 0:00: hi bob | bob at 0:30: hi ada
ada sees post 3 from ada at 2:00: welcome, cat
bob sees post 3 from ada at 2:00: welcome, cat
cat sees post 3 from ada at 2:00: welcome, cat
-- cat signs out, and back in five minutes later
ada sees post 4 from bob at 3:00: lunch at noon
bob sees post 4 from bob at 3:00: lunch at noon
cat connects and reads in general: bob at 3:00: lunch at noon9. Send a direct message
Two people who want to talk privately have only channels, which anyone can join. A direct message is a room of the two, which the workspace makes once per pair.
<transition event="dm.open" cond="!(direct(_event).room in dms)">
<assign location="dm" expr="direct(_event)"/>
<send type="spawn" event="spawn" idlocation="sendid">
<param name="chart" expr="'room'"/>
<param name="name" expr="'room.' + dm.room"/>
<param name="params" expr="({ name: dm.room, members: dm.members, direct: true })"/>
</send>
<assign location="dms[dm.room]" expr="dm.members"/>
<assign location="opening[sendid]" expr="({ room: dm.room, by: _event.origin, with: _event.data.with })"/>
</transition>
<transition event="dm.open">
<send targetexpr="_event.origin" event="dm.opened">
<param name="room" expr="direct(_event).room"/>
<param name="with" expr="_event.data.with"/>
</send>
</transition>Either side asks for dm.forager.scout: the two names, sorted. A channel's name holds no dot, so no channel takes it.
function direct(event) {
const members = [...new Set([event.data.user, event.data.with])].sort();
return { room: 'dm.' + members.join('.'), members };
}The room chart builds on step 8's, so a direct message keeps history, typing and catch-up. Its members come with the spawn, and the room refuses anyone else's join.
<datamodel>
<data id="name"/>
<data id="members" expr="[]"/>
<data id="direct" expr="false"/> <!-- a direct message: its members are fixed -->
</datamodel>
<state id="open">
<transition event="join" cond="direct && !members.includes(_event.data.user)">
<send targetexpr="_event.origin" event="join.refused">
<param name="room" expr="name"/>
</send>
</transition>The other person hears of their direct messages from the workspace when they come online, as they hear the roster. Back from a lost connection, the user chart asks for them with dms.get, as it asks roster.get.
<if cond="arriving">
<send targetexpr="_event.origin" event="roster">
<param name="roster" expr="roster"/>
</send>
<send targetexpr="_event.origin" event="dms">
<param name="dms" expr="dmsOf(dms, _event.data.user)"/>
</send>
</if>Scout writes to forager, who is signed out and reads both posts on signing in. Queen's join is refused, and her post reaches nobody.
client.lines.push('-- scout opens a DM with forager, who is signed out, and posts twice');
scout.send('dm.open', { with: 'forager' });
await host.idle();
const dm = [...client.dms.get('scout').keys()][0];
scout.send('post', { room: dm, text: 'sugar by the oak' });
await host.idle();
clock.increment(30_000);
scout.send('post', { room: dm, text: 'can you carry?' });
await host.idle();
clock.increment(30_000);
client.lines.push('-- forager signs in, types and answers');
client.opened('forager');
forager.send('connect');
await host.idle();
forager.send('typing', { room: dm });
await host.idle();
forager.send('post', { room: dm, text: 'on my way' });
await host.idle();
client.lines.push('-- forager opens the DM with scout: the same one');
forager.send('dm.open', { with: 'scout' });
await host.idle();
client.lines.push('-- queen tries to read it');
queen.send('join', { room: dm });
queen.send('post', { room: dm, text: 'let me in' });
await host.idle();
const [, { rooms }] = await workspace.ask('rooms.list');
client.lines.push(`the channels: ${rooms.join(', ')}`);-- scout opens a DM with forager, who is signed out, and posts twice
scout opens dm.forager.scout, the DM with forager, and reads nothing yet
scout sees post 1 in the DM with forager from scout at 0:00: sugar by the oak
scout sees post 2 in the DM with forager from scout at 0:30: can you carry?
-- forager signs in, types and answers
forager has dm.forager.scout, the DM with scout, and reads scout at 0:00: sugar by the oak | scout at 0:30: can you carry?
scout sees forager typing in the DM with forager
forager sees post 3 in the DM with scout from forager at 1:00: on my way
scout sees post 3 in the DM with forager from forager at 1:00: on my way
-- forager opens the DM with scout: the same one
forager opens dm.forager.scout, the DM with scout, and reads scout at 0:00: sugar by the oak | scout at 0:30: can you carry? | forager at 1:00: on my way
-- queen tries to read it
queen gets an error: not a member
the channels: generalTake it to production
The charts stay as they are; what changes is what your program connects them to.
- ConnectionsHere a screen is a list in memory. In production,
chat:clientwrites to each user's socket, and a closed socket sendsdisconnect. - StorageStep 5's store forgets everything when the process ends.
SQLiteStorekeeps saved actors on disk. - New versionsA new chart leaves running users on the old one. New users start on the new chart, and a migration moves the running ones.
- TelemetryA slow post could be waiting in any of its actors. Every step is a span, so the trace shows where it waited.