Chat rooms for a served game: one process, any number of rooms, the last messages kept.
Cauldron2D.Drafter.Chat.ensure_started()
Cauldron2D.Drafter.Chat.join(:lobby)
Cauldron2D.Drafter.Chat.say(:lobby, "alice", "hello")A process that joined a room receives {:chat, room, %{from: name, text: text, at: ms}}
for every message said in it, and stops receiving when it leaves or exits.
history/1 is the last 100 messages, oldest first.
Summary
Functions
Returns a specification to start this module under a supervisor.
Start the chat server registered under this module, or leave a running one be.
The last messages in room, oldest first.
Receive room's messages in the calling process.
Stop receiving room's messages.
Say text in room as from.
Types
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec ensure_started() :: :ok
Start the chat server registered under this module, or leave a running one be.
The last messages in room, oldest first.
@spec join(term()) :: :ok
Receive room's messages in the calling process.
@spec leave(term()) :: :ok
Stop receiving room's messages.
Say text in room as from.