Hyphenate does not provide storage for app users' data beyond your user's Hyphenate IM account info (Hyphenate ID, password, and APNs display name). As a result, you will need to set up the backend server and database to handle your users' data, such as their profile data, picture, name, phone number, etc.
Because of this, you will need to make a decision on how user data, for the sender of a message, that is shown in your application (such as name and profile photo), will be retrieved on the receiver's device.
- Initial user data acquisition: When sending a message, set the sender user data, such as profile name and picture URL in the message extension and deliver along with the message.
When the receiver gets the message, the sender’s user data can be retrieved from the extension and saved to the local client database.
- User data updates: If the sender's user data from the message extension is different from the local database, then the new data needs to be saved.
The advantage of this approach is speed and simplicity of not having to make another request to your server for the user data. Since the sender's user data will be sent along with the message as an extension, the receiver can obtain it from the message without the need to make an extra request to the app server.
However, every message will require an extension attachment, increasing the data overhead for individual messages. This will slightly slow message delivery, especially if the user is using a slow or bandwidth-limited Internet connection.
Initial user data acquisition: When receiving a message (or group message), one can get the sender’s ID and check if the sender’s data is included in the local mobile device database. If the message recipient doesn't have the sender’s user data locally, the sender's user data will need to be obtained from your app server, and saved in the receiver's local database.
User data updates: When the sender’s profile picture is tapped, the device will search for detailed information from the server, then update the local client database. When a user updates his name or profile picture, the device can also send a pass-through message to other users and groups to keep the information up to date.
Next Section: Create a Group Chat
Updated 2 years ago