Get Started, Part 2: Messaging

Estimated reading time: 4 minutes

Prerequisites

  • Read the introduction in Part 1.

Messaging

In Part 1, we briefly described realtime-messaging and some examples of it. Now, we will go in more details what a message and its properties.

A message is the unit of data which is sent between two users OR multiple users in case of a group message.

A message in mesibo is a raw binary data, essentially an array of bytes. This allows you to send any arbitrary data in real-time, for example, a text message, a binary message, a webrtc SDP, a TLV message, a JSON message or anything limited only by your imagination.

Message Properties

Each message you send or receive, has some properties. Following are some of the key properties on each message transmitted on mesibo.

destination

Each message has a destination where message is sent to. Destination can be a user OR a group of users. The messages are sent to destination in the order they are received on the server. Destination user is also referred to as peer in this document when the direction of message is unspecified.

expiry

expiry represents the time within which a message has to be delivered. Expiry ranges from immediate (zero) to a few days and can be independently specified on per message basis at the time of sending. mesibo will not deliver messages past its expiry. You can also set the expiry to zero for the messages that need to be delivered in real-time and not later. All messages will be retained by mesibo until delivered or until their expiry is reached.

type

Each messages can be assigned a type, default type is 0. This allows you to send different type of messages and apply different processing to it. For example, you can use type 0 for normal messages and type 1 for json messages which requires extra processing to display.

priority

priority represents the priority of the message. Value can range between 0 and 15. 0 represents the highest priority and 15 represents the lowest. mesibo will attempt to deliver higher priority messages before lower priority ones.

identifier

Each message has a unique 64-bit identifier. You can assign your own identifier or it can be generated by the system. You can also set the identifier to be zero for messages that are of type fire-and-forget.

timestamp

time of the message. Mesibo automatically adds timestamp to each message when it was received by the mesibo server.

status

Every message has a status. Incoming messages can have status “New” or “Read”. Similarly, outgoing messages are assigned a status “OUTBOX” when sending them. It then cycles through “Sent”, “Delivered”, “Read” or one of the error conditions like invalid destination, expired etc.

Key characteristics of Messaging

Before we move forward to our next section on group messaging, let’s spend a minute to understand a few most important characteristics of messaging to make your apps reliable and consistence.

Delivery guarantee

A key feature of mesibo, and in fact any carrier grade messaging systems, is reliable messaging. With reliable messaging, the mesibo guarantees that the message will be delivered once and only once to each destination, even in the event of system failure. This is crucial for many businesses as you don’t want your messages to be sent more than once or for your messages to be lost.

In some cases you may not care about delivery guarantee (fire-and-forget) and you may configure so. mesibo allows you to configure delivery guarantees as you require on per message basis.

Duplicate Detection

This is another important characteristic of any carrier grade messaging systems like mesibo. Even if messages are retried, no messages should be delivered in duplicate. Server and client should ensure that any duplicate messages are removed from the queue, at the same time ensure that the delivery of original message is ensured.

Store and Forward

Any messages which can be delivered in real-time should be stored and should be delivered as soon as destination is ready to receive it.

Conclusion of part two

That’s all for this page. In the next section, we learn about group messaging in which messages can be send to multiple users in one shot.

Continue to Part 3 >>

chat, message, destination, group messaging