Frequently Asked Questions - Messaging
Estimated reading time: 9 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?
- What is the retention period of messages stored in the database?
- How read-receipt works?
- What is Message Expiry?
- Where is messages stored?
- What should be the cause if my messages are not delivered?
- Can I schedule messages ?
- Does Mesibo support typing indicators?
- How do I know Online/Offline Status of a user?
- Does mesibo support non-English/Asian/European languages?
- Is it possible to deliver messages via email?
How to send a message?
To send a message, just create an instance of MessageParams
, populate with id
and 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.
Refer Basic concepts and real-time API reference section in the documentation for details.
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.
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?
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 a typical 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.
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
Where is messages stored?
There are three types of storage mesibo uses to store your data:
-
Local Device Storage: The messages sent and received by a user can be stored in a local database at the user end for faster access. You can enable a local database to store all incoming & outgoing messages and other information by using setDatabse while initializing mesibo.
-
Server-Side Storage: When User A sends a message to User B and if User B is not online, mesibo stores messages on the server till User B comes online. Once the message is delivered to User B, it is deleted from the server unless the retention option is enabled. If you enable the retention option, all the communication between your users is stored on the server. If you are hosting mesibo on your servers using mesibo on-premise, all the messages will be saved on your own database.
-
File Storage: All the files you transfer using mesibo are stored in a file server. The mesibo does not mandate where you store your files. You can store your files on your private file server or AWS, Azure, or any such cloud hosts. You need to write a file handler so that mesibo can upload to or download files from your server.
What should be the cause if my messages are not delivered?
Mesibo offers guaranteed and ordered delivery of messages. Under normal conditions, mesibo does not drop or throttle your messages. However, your messages can be discarded by the mesibo in the following cases:
-
Setting a low expiry value when sending messages. The message will be discarded if the recipient is not online before the expiry of the message
-
Messages with zero message ID will be discarded if the recipient is not online
-
Invalid Destinations, this can be an invalid user, an invalid group, or the user is not a member of the group
-
mesibo in cloud deployment detects too many failed messages or flooding, the user may be throttled.
On the client-side, mesibo stores all the outgoing messages in the database so that they can be sent when the user is online. However, if you do not set the database and the app is terminated by OS, all the unsent messages will be lost. You should check the message status to know if the message was sent from the client-side and received by mesibo.
If you think none of the above is the cause, you can use webhook or on-premise deployment to diagnose the issue.
-
Use webhook and configure it to be invoked for all the failed messages. If your message has reached the mesibo server and was not delivered, you should know about it in the webhook payload. If the message was not delivered, nor the webhook was invoked, you should check the client-side.
-
Alternatively, if you are using mesibo on-premise, enable message retention. This will allow you to verify that if your messages are reaching your on-premise mesibo server.
If the issue persists, report mesibo support with the results of the above-mentioned procedure.
Can I schedule messages ?
Yes, you can use the backend API to schedule messages. Refer to the when
parameter in the message
API.
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 Online
or Offline
. You can also use webhook to get instant notification whenever the user is Online
OR Offline
.
However, the interpretation of Online
and 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, Online
and 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.
Does mesibo support non-English/Asian/European languages?
Yes, mesibo is based on Unicode and hence supports all languages, fonts, and emojis.
Is it possible to deliver messages via email?
You can use a webhook to deliver your messages to email or any third-party channels. When a message arrives, mesibo can invoke your webhook depending on the settings you have selected in the mesibo console. You can then send emails from your webhook to your users.