Message
Definition
A message is the basic communications unit for the Second Life world. Messages are used to pass serialized information about almost every part of the system back and forth between two hosts on a network, through connections known as circuits.
There are many hundreds of messages in the Second Life message system. A list of them is available at Category:Messages.
Message Format
Messages are defined in the Message Template. They follow the format:
{ [Message Name] [Message Frequency] [Message Trust Level] [Message Encoding] { [Block 1 Name] [Block 1 Quantity] [Block 1 Count] { [Block 1 Parameter 1 Name] [Block 1 Parameter 1 Type] } { [Block 2 Parameter 2 Name] [Block 2 Parameter 2 Type] } [...] } [...] { [Block n Name] [Block n Quantity] [Block n Count] { [Block n Parameter 1 Name] [Block n Parameter 1 Type] } [...] } }
For example
{ TestMessage Low NotTrusted Zerocoded { TestBlock1 Single { Test1 U32 } } { NeighborBlock Multiple 4 { Test0 U32 } { Test1 U32 } { Test2 U32 } } }
Preamble
The preamble contains information about the message as a whole.
- Name
- Values: [string]
- Name of the message. Follows C variable naming restrictions.
- Frequency
- Values: High|Medium|Low|Fixed [U32]
- Determines whether the message ID is 8, 16, or 32 bits. There can be 254 messages in the High or Medium, 32K in Low. A message with a "Fixed" frequency defines its own ID and is considered to be a signal. For more information, see Packet Layout
- Trust Level
- Compression
- Values: Unencoded|Zerocoded
- Zerocoding will attempt to compress sequences of zeros in the message in order to reduce network load. If there is no major size difference after the compression, it is discarded and the message is sent uncompressed.
Blocks
Blocks are delimiters for groups of data in a message.
- Name
- Values: [string]
- Name of the block. Follows C variable naming restrictions.
- Type
- Values: Single|Multiple [U8]|Variable [U8]
- Determines how many blocks are contained in the message. "Multiple" means a static number of blocks in every message, and is followed by an 8 bit number to tell how many times the block is repeated, "Variable" lets the sender specify the number of blocks on sending (also an 8 bit number).
Variables
Variables contain the data sent with the message
- Name
- Values: [string]
- Name of the variable. Follows C variable naming restrictions.
- Type
- Values: Null/Fixed [U32]/Variable [U32]/U8/U16/U32/U64/S8/S16/S32/S64/F32/F64/LLVector3/LLVector3d/LLVector4/LLQuaternion/LLUUID/BOOL/IP_ADDR/IP_PORT/U16Vec3/U16Quat/S16Array/EOL
- The type of the variable. "Fixed"/"Variable" are used to denote sizes for things like blobs.