-
Notifications
You must be signed in to change notification settings - Fork 0
offline ids
When offline/on the client we are unable to assign global unique ids to objects.
Before register the client assigns an internal id to created users. These ids have the serverId-part set to 0 indicating it has not been set. When sending the command to the devices managingServer this id is passed along with the registerUserRequst and returned in the response. This allows for multiple users to be registered and for them to take basic actions before a network connection is established again.
graph LR;
Client-- createUser 0.1 --> Client
Client-- setUserName 0.1 --> Client
Client-- createUser 0.2 --> Client
Client-- addFriend 0.2 0.1 --> Client
Network established again
graph LR;
Client-- createUser 0.1 --> Server
Client-- setUserName 0.1 --> Server
Client-- createUser 0.2 --> Server
Client-- addFriend 0.2 0.1 --> Server
The addFriend would fail because the id is not known by the server anymore when the command comes in.
To migrate this, localIds are replaced with received onlineids (serverId set) bevore sending. To do this, it is attempted to load the resource and replace the senderId or receiverId with the id of the Resource. Since old local ids are replaced with RedirectResources to the new online ids, this method will set the id correctly.