Skip to main content

User Information

There are multiple ways to identify users in a Connected Lens session through the UserInfo class – UserInfo.userId, UserInfo.connectionId, and UserInfo.displayName.

UserInfo is available from a number of sources, including SessionController APIs, SyncEntity.ownerInfo, and NetworkRoot.ownerInfo. MessageInfo for Networked Events also includes userId and connectionId of the message sender.

UserId

UserInfo.userId is tied to a user’s Snapchat account. If two pairs of Spectacles are paired to the same user account, the userId for those devices in the session will be the same. The userId for a given user is different in different Lenses. UserInfo.userId is a string.

ConnectionId

UserInfo.connectionId is tied to the device that has joined the session. UserInfo.connectionId is unique to each connected device, and unique to each time the device joins a session. Realtime Store ownership is tied to connectionId, not userId. UserInfo.connectionId is a string.

DisplayName

UserInfo.displayName is the name a user chooses on their Snapchat account profile. It is consistent across devices, Lenses, and sessions. UserInfo.displayName is a string.

Example Scenario

This is a simple example showing a situation where one user joins a Connected Lenses session on two devices at once, and another user joins on a single device. These example userIds, connectionIds, and displayNames are simplified for explanation.

Lens #1

userIDconnectionIDdisplayName
Spectacles User Aabc123Spectacles A
Spectacles User Aabc456Spectacles A
Spectacles User Bdef789Spectacles B

Lens #2

userIDconnectionIDdisplayName
Spectacles User Aghi987Spectacles A
Spectacles User Aghi654Spectacles A
Spectacles User Bjlk321Spectacles B
Was this page helpful?
Yes
No