Don't click here unless you want to be banned.

LSL Wiki : ExchangePacketChat

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org

Packet Chat Protocol

This protocol was developed so that chat messages can be encoded in such a way that a large (> 255 character) string can be sent through the chat system in 255-character substrings ("packets") and reconstructed at the receiving end.

Each packet is composed of four sections, three of which are of a constant length:
<message identifyer><packet index><packet count><packet data>

The <message identifyer> is a two-byte little-endian hexadecimal number. It must be four characters in length, or padded with zeroes. All of the packets that compose a particular message must have the same message identifyer. The message identifyer should carry with it no meaningful information about the message itself - it only serves to associate multiple packets with the same message. It should be randomly generated to avoid collisions.

The <packet index> is a one-byte little-endian hexadecimal number. It must be two-characters in length, or padded with zeroes. The first packet that a message is composed of must have packet index 0, which will appear as "00". The next packet composing the message has packet index 1 ("01") and so on.

The <packet count> is a one-byte little-endian hexadecimal number. It likewise must be two-characters in length, or padded with zeroes. This number must remain constant throughout the packet transfer, and represents the number of packets the message is composed of.

The <packet data> portion of the packet may be of variable length, with a maximum length of 247 characters (255 max chat characters - 8 metadata characters).

To encode a message, the original message string is divided into segments, 247 characters in length at maximum. Each of these is assigned a packet index corresponding to the location of the segment in the original string. (The first segment has index 0, the second index 1, etc). The packet metadata (message identifyer, packet index, and packet count, as described above) is then prepended to the segment, and the resulting <=255-character string sent to one of the chat functions. The packets must be sent in sequence.

Example:
Original message:
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi est mi, scelerisque id, laoreet nec, sollicitudin elementum, mi. Sed laoreet interdum magna. Aenean rhoncus imperdiet justo. Vestibulum dui dolor, condimentum sagittis, interdum eu, adipiscing ac, velit. Etiam faucibus, lectus in metus."

Segments (assuming maximum space efficiancy, 247 data chars/packet):
SEGMENT 1:
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi est mi, scelerisque id, laoreet nec, sollicitudin elementum, mi. Sed laoreet interdum magna. Aenean rhoncus imperdiet justo. Vestibulum dui dolor, condimentum sagittis, interdum eu, a"

SEGMENT 2:
"dipiscing ac, velit. Etiam faucibus, lectus in metus."

Packets:
PACKET 1:
"F92C0002Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi est mi, scelerisque id, laoreet nec, sollicitudin elementum, mi. Sed laoreet interdum magna. Aenean rhoncus imperdiet justo. Vestibulum dui dolor, condimentum sagittis, interdum eu, a"

PACKET 2:
"F92C0102dipiscing ac, velit. Etiam faucibus, lectus in metus."


Protocol Implementations:
LibraryChatCodec


Protocol Exchange
There is one comment on this page. [Display comments/form]