Frequently Asked Questions - MessagingEstimated reading time: 5 minutes
- How to send a message?
- How do I get the status of a message I sent?
- What happens when I send messages to a user who is not online?
- Can I schedule messages ?
- What is the retention period of messages stored in the database?
- How read-receipt works?
- Does Mesibo support typing indicators?
- How do I know Online/Offline Status of a user?
- What is Message Expiry?
How to send a message?
To send a message, just create an instance of
MessageParams, populate with
message and use the
sendMessage function to send it to a user or a group.
That’s it. Mesibo takes care of everything including connection handling, retries, error handling, flow control, etc. Mesibo delivers messages instantly if the destination user is online. If not, messages will be delivered as soon as the destination user is online. This is automatic and transparent to applications, so applications sending messages do not need to worry if the receiving applications are up and running. Conversely, receiving applications need not worry about the status of the sending application.
How do I get the status of a message I sent?
Mesibo informs you in real-time about the status of every message sent in
Mesibo_onMessageStatus callback. Refer real-time API reference section in the documentation for details.
What happens when I send messages to a user who is not online?
Mesibo uses cut-through switching to deliver your messages in real-time with minimum latency. However, if the destination is not online, Mesibo stores the messages until the user is online. If you decide not to save messages in the database, you can do so by setting a flag while sending messages using real-time API.
Can I schedule messages ?
Yes, you can use the backend API to schedule messages. Refer to the
when parameter in the
What is the retention period of messages stored in the database?
Mesibo offers an unlimited message retention period, only limited by the storage quota and usage. You can at any time, clear storage from the Mesibo console or using the backend API.
How read-receipt works?
The app logic controls the read-receipt. Mesibo real-time API sends read receipts when the app opens a read-session with read-receipts enabled and then reads messages. Mesibo then continues to send read-receipts for future messages from the same user until the app closes the read session. In typically chat application, the app opens the read-session when a chat window is opened or resumed, and closes the read-session when the chat window is stopped/paused. If the app does not close the read-session, mesibo will continue to send read-receipts.
Does Mesibo support typing indicators?
Yes. Not only does Mesibo support typing indicators, but it also allows you to send and receive an unlimited amount of presence information such as typing, online, left, joined, etc or any custom presence information specific to your app, like shooting, tapping in a game, etc. Refer real-time API reference for details.
How do I know Online/Offline Status of a user?
The short answer is, each user has
lastActiveTime. You can use it to determine if that user is
Offline. You can also use webhook to get instant notification whenever the user is
However, the interpretation of
Offline status varies from an app to the app. For some apps, it’s just the connection status, and for other apps, a user is considered
online when actively using the app while being connected. Hence,
Offline status requires a bit of elaboration.
In the past, apps could stay online even when running in the background. However, it’s no longer the case. Both Android and iOS will suspend the app after app moves to the background. Read more about Android and iOS background execution limits here and here.
So technically speaking, most users are offline unless they are actively using the app. When you send a message, a push notification will wake them up, and the app will be online. This still does not mean that the user is actively using the app since the message was delivered when the app was in the background. So if your app only considers the connection status as
Online status, the above answer will suffice. However, if you would like to extend your app to know the
active status, you can send an
Online Activity (see the previous question on using Typing Indicators) based on which a remote app can decide to answer based on their `Online’ status. This is more effective but has privacy implications. Hence, based on your app policy, mesibo lets you choose the implementation.
What is Message Expiry?
The 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 per-message basis at the time of sending messages. 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
For example, to set an expiry of 7 days you need to specify it in seconds (7 days * 86400 sec/day)
p.expiry = 604800