Tech and Media Labs
This site uses cookies to improve the user experience.




IAP - Message Structure

Jakob Jenkov
Last update: 2016-01-05

IAP has a basic message structure that is designed to support the message flows which IAP is intended to be able to support. Additionally, the basic message structure must also support the creation of multiple independent semantic protocols, and the concepts of channels and message sequences.

All IAP messages are encoded as an ION Object field. Inside this object field you may have a set of property name and property value pairs representing message headers. These property names and values are encoded using an ION Key field followed by another ION value field. The object field may also contain a message body. How the message body is represented depends on the semantic protocol.

In the following sections I will explain the basic IAP message structure property for property. To see the full message structure you must scroll to the bottom (or click one of the links in the TOC at the top of the page).

IAP Messages as ION Objects

As mentioned in the introduction an IAP message is encoded as a single ION Object field. This message structure is outlined here:

  • ION Object

Sender And Receiver

Some systems require IAP messages to be routed over intermediate nodes. For instance, a P2P network. To be able to route messages over intermediate nodes the messages must contain an identification of the receiver of the message. Similarly, if a receiver is to be able to respond to the sender, the original message must also contain an identification of the sender of the message.

  • ION Object
    • Sender ID
    • Receiver ID

If communication takes place between two directly connected nodes, and no subsystems within these nodes can communicate independently, then there might be no need for an explicit sender and receiver ID. Therefore the sender and receiver ID are optional.

Channels

IAP supports multiple "channels" of communication of the same IAP connection. If two nodes communicating via IAP uses channels, each message must be associated with a channel. This is done using a channel ID property.

Here is what the basic IAP message structure looks like with the channel ID property added:

  • ION Object
    • Sender ID
    • Receiver ID
    • Channel ID

The Channel ID property is optional.

Message Sequences

By default all messages sent by a sender are considered independent, and can be processed independently, and out of order (meaning in different order they were sent in). For messages that to be processed in sequence, IAP supports the concept of message sequences. Messages that are part of a message sequence must be processed according to the order they have in the sequence.

To support message sequences IAP messages can make use of three message sequence specific properties. These properties are: Message sequence ID, Message index and "Is last" . The message sequence ID identifies the message sequence the message is part of. The message index specifies what index (position) the message has in the sequence.

The "Is Last" property specifies whether the message is the last in the message sequence. The receiver might have to allocate resources to process the message sequence. Therefore it is important that the receiver is notified when the last message has been received, so the resources allocated for the message sequence can be freed again.

With the addition of these 3 properties the basic IAP message structure looks like this:

  • ION Object
    • Sender ID
    • Receiver ID
    • Channel ID
    • Sequence ID
    • Sequence Index
    • Is Last

Semantic Protocols

What information an IAP message should contain inside the ION Object field really depends on the semantic protocol. In other words, it depends on what the IAP message is trying to achieve. Video streaming does not require the same information as file exchange, and VoIP doesn't need the same information as a chat protocol.

To identify what semantic protocol a given IAP message is part of, an IAP message should contain a property identifying the semantic protocol. With the semantic protocol property the basic IAP message structure looks like this:

  • ION Object
    • Sender ID
    • Receiver ID
    • Channel ID
    • Sequence ID
    • Sequence Index
    • Is Last
    • Semantic Protocol ID

The semantic procotol ID is optional. Yes, each message must be associated with a semantic protocol, but later IAP features enable you to do so in other means than by attaching a semantic protocol ID to every single message. Basically you can set a default semantic protocol for a connection or stream

Jakob Jenkov




Copyright  Jenkov Aps
Close TOC