Browse SDKs · uni-app / uni-app x
Platform
SDKsuni-app / uni-app xIncludes Enterprise features

User overview

Understand user profiles, account-level preferences, and online status in the UniApp SDK.

Copy

The UniApp SDK identifies users using a unique userID. The user domain manages the authenticated account's profile, public user cards for other contacts, account-wide message reception options, friend request permissions, and real-time online presence. Relationships (friends, applications, and blacklists) belong to the separate relationship domain, while group nicknames and roles reside within the group domain.

User data models

The UTS plugin exports the following primary user data structures:

TypeIntended contextHow to obtain
OpenIMUserInfoThe currently logged-in user profile; also serves as the base structure for public cardsGet your profile, Get user profiles
OpenIMPublicUserItemPublic profile for other application users (alias of OpenIMUserInfo)Get user profiles
OpenIMFriendUserItemFriend profile including friend remarks, pinned status, and custom extension stringsFriend query APIs in the relationships domain
OpenIMBlackUserItemBlocked user profile stored within the current account's blacklistBlacklist query APIs in the relationships domain
OpenIMUserStatusItemAggregated online connectivity status and active client platforms for a userOnline status subscription and query APIs

A single userID can exist simultaneously as a public user, friend contact, blacklisted user, and group member. Render stranger profiles using OpenIMPublicUserItem; render contact rosters using OpenIMFriendUserItem; render group rosters using OpenIMGroupMemberItem; and display conversation headers using showName from the conversation object. Do not overwrite fields across distinct domains.

User profile APIs

Online status APIs

Online presence indicates whether a user maintains an active WebSocket session with OpenIMServer; it does not indicate whether they are viewing the app, a specific conversation, or a particular message. For typing indicators or business presence (such as "in a meeting"), use dedicated business signals rather than inferring state from WebSocket connectivity.

State synchronization principles

Load baseline snapshots via query APIs when initializing screens, then merge incoming updates through domain events. Merge current user profiles by matching userID. When online status events arrive with multiple OpenIMUserStatusItem records, iterate and merge each item into your state by userID.

Promise resolution, event delivery, and re-queries represent three distinct phases. After a mutation Promise resolves, update UI state via the corresponding event, or call the query API to re-calibrate immediately.