A protocol message is represented by the Message data structure.
dictionary Message {
required DOMString sessionId;
required unsigned long messageId;
required unsigned long timestamp;
required DOMString type;
any args;
};
A Message has an associated sessionId, a string that uniquely identifies the session to which the Message belongs.
A Message has an associated messageId, an integer that increments with each message sent by the sender over the session specified by sessionId.
Note: The combination of sessionId and messageId uniquely identifies a single message. The combination of the values of these two attributes may never occur twice.
A Message has timestamp property. timestamp is expressed in a number of milliseconds since January 1, 1970, 00:00:00 UTC (Epoch time). Message sender must set timestamp value as close as possible to the moment the underlying process occurs. However, the receiver should not assume that timestamp value reflects the exact instant Message triggering event chain was accomplished.
For example, if Message communicates ad video state change, media player sets timestamp value to the moment the corresponding video event arrives from HTMLVideoElement.
A Message has an associated type, a string that defines the type of message that is being sent and informs the receiver how to interpret the args parameter.
A Message may have associated args, which are type-specific additional arguments. The data structure and meaning of args is defined in the respective message type definitions.