Weave Messaging

Weave Messaging

At the heart of Weave is messaging. To carry out the functionality of profiles, resources in a HAN must be able to message each other.

Weave Reliable Messaging

Weave Reliable Messaging (WRM) is Weave application layer messaging with acknowledgements. It ensures reliable delivery of any type of general or tunnel message between any two resources in a fabric, regardless of their underlying network transport.

Weave TLV

Weave TLV (Tag-Length-Value) is a binary format for compact encoding of data. TLV is representationally compatible with JSON and is optimized for effective deserialization. It is most similar to data formats such as CBOR and ASN.1, but typically simpler and smaller than either for a given set of data to encode and represent.

Weave messages are encoded in TLV, which was designed with constrained devices in mind. TLV ensures the smallest amount of data—with the simplest possible encoding—is transferred over the wire.

Weave TLV is not human-readable, so you won't need to encode anything in Weave TLV or deal with it directly—you simply specify the type of message and its contents, and Weave does all the work for you.

Message types

There are two types of Weave messages, which may be transmitted in encrypted and unencrypted form. The process of encrypting both types of message is the same, and messages of both types can be encrypted using the same keys.

General messages

General messages are used by Weave applications to convey application-specific data and requests. They contain elements that describe the semantic meaning of the message, as well as the structure of the payload:

  • Profile ID — Which profile should handle the message
  • Message Type — The specific type of message (the action)
  • Exchange ID — Identifies a message exchange flow between two resources

General messages may also convey information that acknowledges the receipt of an earlier message. This is part of the Weave Reliable Messaging protocol.

Tunnel messages

Tunnel messages encapsulate an encoded IP packet (IPv6 in practice, though IPv4 is supported) that is being transported between two Weave resources. Tunneled messages are simpler in structure and forgo many of the application-specific headers present in a general message.

The tunneled packet can convey any valid IP protocol including UDP, TCP, or ICMP.

Recap

What you learned:

  • Weave Reliable Messaging ensures reliable delivery of Weave messages for two forms of exchange:
    • Request-Response
    • Subscribe-Update
  • Weave TLV is a binary format for compact encoding of Weave messages
  • There are two types of Weave messages:
    • General messages are used to convey application-specific data and requests, such as those used by profiles
    • Tunnel messages encapsulate an IP packet

For more in-depth information, see: