Docs For developers scrawlee.yml
scrawlee.yml
Every value and room your Scrawl uses, with its type and rules. Scrawlee refuses to publish a file with problems and lists each one with its line.
The file
Name it scrawlee.yml and put it at the root of the published files. An update without it keeps the one already online. Everything goes under one cloud: key. The first line below gives editors such as VS Code autocompletion and checks as you type.
# yaml-language-server: $schema=https://www.scrawlee.com/schema/scrawlee.yml.json
cloud:
sign_in: optional
name: ask
types: {} # your own types
data: {} # values
rooms: {} # kinds of room sign_in and name
sign_in: optional | The default. Anyone can use the Scrawl; saving asks people to sign in and choose. |
|---|---|
sign_in: required | The Scrawl loads only for people signed in who answered the consent panel. Only if it cannot work without it. |
sign_in: none | Read only: the Scrawl shows values but nobody writes. |
name: ask | The default. People choose their username, a random name or no name. |
name: none | Nobody is asked for a name: everyone appears as Anonymous. |
Scopes
scope: shared | One value for everyone. Add who: creator so only you write it. |
|---|---|
scope: own | One value per person, only they read it. |
scope: public | One value per person, everyone can read it under the name they chose. |
Types
Names of values, fields, rooms and types have 1 to 32 lowercase letters, digits or underscores and start with a letter. A single value (int, number, bool, string, enum) can have a default.
int, number | Optional min and max. |
|---|---|
bool | true or false. |
string | max_length (required) and an optional pattern. |
enum | values: [a, b, c], one of them. |
object | fields, each with its own type. |
list | items (their type) and max_items. |
map | key (a string or an enum), value and max_entries. Read and written by key. |
| your own | Declare it under types: and use its name as type. |
Write rules
write: set | The default: any valid value. |
|---|---|
write: add | Changes only with add (numbers), safe when many people add at once. |
write: increase, decrease | A number that only goes up, or only down. |
write: once | Set once, then it cannot change. |
step_max | With add, increase or decrease: the largest change in one write. |
rate | Writes per person, such as 10/min (/s, /min, /hour, /day). |
rank: asc, desc | On a public number: a ranking is available. |
Rooms
Each kind of room has max_members (2 to 64), an optional state (entries with a type and its rules, shared by the members) and messages (each with a type and a rate per person, 10 a second by default). A message is 1 KB at most.
rooms:
match:
max_members: 4
state:
turn: { type: int, min: 0, default: 0 }
messages:
move: { type: object, rate: 20/s, fields: { x: { type: int }, y: { type: int } } }
cheer: { type: enum, values: [nice, wow, again] } Patterns
A pattern must match the whole text. Write the characters you allow, such as [A-Za-z0-9 ]+, instead of \w or \s, which Scrawlee refuses. You are responsible for what a pattern lets through: a name limited to letters and digits cannot carry a message.
How large can values be?
Scrawlee works out the largest size each declaration allows and refuses the file when it passes a limit: 64 KB for one value or one map entry, 256 KB for all the own values of one person together, 16 KB for a room's state and 1 KB for a message. Lower max_length, max_items or max_entries to fit. What a whole Scrawl may store is on the Limits page.
Changing the file in an update
Adding values and rooms is always safe. Values already stored are not converted: rather than changing the type of a value people already use, declare a new one.