Get Started, Part 2: MessagingEstimated reading time: 4 minutes
- Read the introduction in Part 1.
In Part 1,we briefly described real time-messaging and some examples of it. Now, we will go into details of what a message is and it’s 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.
Each message you send or receive has some properties. Following are some of the key properties on each message transmitted on mesibo.
Each message has a destination where a message is sent to. The destination can be a user OR a group of users. The messages are sent to a destination in the order they are received on the server. The destination user is also referred to as peer in this document when the direction of message is unspecified.
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.
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 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.
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.
time of the message. Mesibo automatically adds timestamp to each message when it was received by the mesibo server.
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 consistent.
A key feature of mesibo, and in fact any carrier grade messaging systems, is reliable messaging. With reliable messaging, 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.
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 sent to multiple users in one shot.chat, message, destination, group messaging