Skip to content

Message

One entry in a campaign’s chat and dice log.

A Message is whatever appears in the log: player chat, a dice roll, a roll on a table, or a slash command typed by a user. Messages are exchanged with the browser player client over the WebSocket connection and stored per campaign.

The content field is polymorphic — plain text for chat, a JSON-encoded payload for rolls — so read it through diceRoll or tableRoll rather than directly. A message that arrives as a command is rewritten in place by process() into the message it produces.

  • SeeAlso: Campaign, DiceRoll, TableRoll

View JSON Schema

Property Type Required Description
id string Yes The unique identifier for this message. A UUID string automatically generated when the message is created. This serves as the primary key in the Realm database.
type string Yes The kind of message, as the raw value of a MessageType. Use typeValue for the typed form; unrecognized values read back as chat.
Examples: "chat", "roll", "tableRoll", "command"
source string No Who sent the message. The connected client’s name, or nil for the game master — which is why it renders as "Dungeon Master" when absent.
Examples: "Alice"
color string No The sender’s accent color. An RGB string used for the bullet marking the message, letting each player be recognised at a glance.
Examples: "#ff6600" SeeAlso: colorValue
creature string No The creature the message was sent on behalf of. Set when a player speaks or rolls as a specific character, and shown before source in the message heading.
Examples: "Thorin Ironforge"
content string No The message payload. Its meaning depends on type: markdown text for chat and command, and a JSON-encoded roll for roll and tableRoll. Note: Prefer diceRoll and tableRoll, which decode the payload and guard against reading it as the wrong type.
created string (date-time) Yes When the message was sent. Automatically set to the current date and time when the message is first instantiated. Orders the log.

What kind of entry a Message is.

Type: string — one of:

  • chat
  • roll
  • tableRoll
  • command