Each drawing command, like penmove, penup or fillrect has a unique message type. The history of a drawing session is a sequence of these commands. The history can be recorded and replayed, producing the same end result.
Normally, the commands are encoded in an efficient binary format, but a text encoding is also supported. Here is a short example recording that can be opened in Drawpile.
The above sample creates a 100x100 image with a single layer and draws a diagonal line across it. See tests/ directory for more examples.
Message types can also be divided into Transparent/Opaque (the messages the server needs to understand and the ones it just passes along) and recordable/nonrecordable (ones that make sense to store in recordings) types.
Control messages are used for client/server communications (e.g. negotiating login details, setting server properties, etc.) and are not relevant to drawing.
Meta messages are not directly related to drawing, but may affect how subsequent commands are filtered. They include things like user login notifications and layer access control settings.