I am working on a game that will be making heavy use of cloud data. We are currently using Realm and Atlas.
We are developing in Unreal Engine which does not have a Realm SDK. As a result I have been trying to develop a NodeJS server that will act as a “gateway” to Realm functionality. The idea is for the game to make requests to an endpoint like
ourapi.com/user/login which will then authenticate using the NodeJS SDK behind the scenes.
As I am researching this approach I am realizing that there will likely be a problem with session management. My understanding after a lot of digging through documentation is that Realm will store users locally, in the case of Node in a folder on the server. Only one user can be “Active” and any database interactions will happen in the context of that user.
I am imagining a scenario like the following:
- User A authenticates to the Node API
- Node API logs into Realm. The active user is set to User A.
- User B authenticates to the Node API
- Node API logs into Realm. The active user is set to User B.
- User A requests to see their profile from the Node API
What happens next? Will Realm return User B’s data instead of User A because only one user can be active at once? How can multiple users be active at a time?
I would really appreciate guidance here.