Frequently Asked Questions - API
- I am not getting connection status 1 - `online`
- How to get all active conversations and groups that a user is part of?
- Message sent from console but not recieved on the application
- How can I send a message to online users only?
- How can I get read receipts?
- What is Message Expiry?
- How do I restrict user access tokens to a particular app or domain?
I am not getting connection status 1 - `online`
If you are not getting connection status 1, and getting 4 or 5, you are not passing the correct appid while creating a token. The appid passed to create a token must match the Android package name declared in the AndroidManifest.xml (and google-services.json), Or iOS bundle id declared in the Xcode project (for example, com.mesibo.xxx ). If you are using Javascript API or other platforms, ensure that you pass the same app id to the setAppName
API call.
Also, ensure that you are NOT using the App Token. App Token must be secret and should only be used from the backend API. You MUST only use user token in your real-time API.
Refer tutorial here https://mesibo.com/documentation/tutorials/first-app/#create-users-endpointsopen_in_new
How to get all active conversations and groups that a user is part of?
Use admin APIMessage sent from console but not recieved on the application
Ok refer this Github Issue reported .How can I send a message to online users only?
Set expiry to zero , then messages will be sent only in real time and to users who is online only.How can I get read receipts?
In message parameters while sending a message, set flag like so:
p.flag = MESIBO_FLAG_READRECEIPT
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
How do I restrict user access tokens to a particular app or domain?
User access tokens are only applicable to your App and issued only to authorized users by you and hence there is less possibility of anyone reusing it.
For Android and iOS, user access tokens are restricted to the Android package name or iOS bundle ID. They can not be used on apps having a different app or bundle ID. Refer to the User Management API to learn more, However, multiple apps with different package names or bundle ID can come under one mesibo app and can communicate with each other as long as you use corresponding package name or bundle ID while generating token for that particular app user.
For Javascript, there is no reliable method to detect domain or app name, and hence the same security policy does not apply. Domain and referrer methods used by many service providers (including Google) are subject to DNS or referrer spoofing and hence we do not want to offer a false sense of security to our users. We are investigating better methods. If you are particularly concerned, you can dynamically generate user access tokens for a short duration and destroy them after use. If you have other suggestions, we'd like to hear from you.