Device
Separate a Device from a connection and understand multi-endpoint presence, shared state, and device-local state.
A Device is a concrete client endpoint through which a user accesses WuKongIM, such as a mobile app, browser, or desktop application. One user can own multiple devices and may use the messaging service from several devices at once.
A Device is not the User and is not one network connection. A network change or reconnect creates another connection, while user and device identity normally remain stable.
Why devices matter
- Enable multi-endpoint use: One UID can send and receive from phone, Web, and desktop clients.
- Define synchronization scope: Ordinary persistent messages and conversations are generally UID-scoped, while drafts, download progress, and push tokens belong to a concrete device.
- Control online policy: A product can allow same-category devices to coexist or let a new connection replace an old one.
- Support removal and revocation: Removing a device requires more than disconnecting its current socket; credentials and product device state also need cleanup.
Relationship to other concepts
- A User can own multiple devices, all sharing one UID.
- An ordinary persistent Message leaves through one concrete connection and may reach the user's other active devices or synchronize later.
- A Channel and its persistent history do not belong to one device; a replacement device can recover them when authorized.
- A Conversation is generally UID-scoped, while each device owns final presentation and local caches.
Four terms that are easy to confuse
| Term | Meaning | Example |
|---|---|---|
| UID | Product user identity | alice_123 |
| Device Flag | Client category | APP, WEB, PC |
| Device ID | One concrete installation or endpoint | alice_iphone_01 |
| Connection / Session | One current TCP or WebSocket connection | Changes after disconnect and reconnect |
Device Level describes conflict policy for connections under the same UID and Device Flag, such as allowing several Web endpoints or keeping only one active. It is not a product permission such as administrator, paid member, or group role.
See Device Flags for current values and enforcement boundaries.
Which state is shared across devices
| Generally shared by UID | Generally owned by one device |
|---|---|
| Ordinary persistent Channel messages and message order | Local drafts, scroll position, and download progress |
| Conversations, unread baseline, and hidden range | Provider push token, notification permission, and background limits |
| Account and group relationships from the product backend | Local cache, encryption material, and device risk information |
When one device clears unread state, another device may observe the new value during its next synchronization. An ordinary persistent message may also reach multiple active connections; each device still handles receive, deduplication, and local storage independently.
A typical device lifecycle
- The product backend selects the UID, Device Flag, Device ID, and connection policy for this user and installation.
- The client connects, and the server associates that Session with the user and device.
- While online, the Session exchanges messages in realtime; it expires after disconnection.
- Reconnect creates a new Session and recovers missing content from persistent message progress.
- On logout or device removal, the product revokes credentials, closes connections, and removes push bindings.
A trusted backend controls multi-device policy
A client cannot promote its own Device Level. The current v3 Beta default Gateway also does not automatically turn stored token and Device Level metadata into a complete verification chain. Include this policy in your release checks.
Continue with Conversation and Authentication & Security.