The way to go for queues of users.
For a multiplayer game I want to use Deepstream. I need to add/remove users to a queue to wait (list?). On a certain trigger the users that are currently in the queue must be replaced to another queue. Is this usecase possible with lists of Deepstream? I am very new to Deepstream and currently reading the docs, but already have some questions.
Fundamentally, lists are suited for your problem. Can you please clarify what you mean by "trigger"?
By "trigger" I mean an event which occurs.
So users are in some kind of list and have to wait. As soon as someone hits a button. The game starts and the users are replaced from the waiting queue to another queue. Since there are a lot of these smaller queues and these smaller queues aren't aware of each other.
Hi @rsdrsd , lists are certainly suited for what you describe. It might be better though to use lists for larger collections (e.g. the general lobby of your game) and use records for the actual rooms that combine information about the game session (e.g. the map you're playing on, other settings) with the list of actual participants.
Users could be moved on an RPC or on the creation of a new game room. Please let me know if this helped,
In the docs I read that it is possible to reference a list in a record. But how is this accomplished? Is it just a key in the record with the list name or is it something that is undocumented. This is the part:
use records for the actual rooms that combine information about the game session (e.g. the map you're playing on, other settings) with the list of actual participants.
Or is it better to use an array of users in the record, because I need to keep track of the online users. For example if the user closes the browser, how do I remove the user from the record, do I need to do it by using a backend client, which listens for connections and disconnections?
Hi @rsdrsd ! Apologies was for an extremely delayed reply. If all you are trying to do is to track the online status of the users, deeptsream provides a feature called presence, using which a callback is invoked whenever any user comes online or goes offline. You can then handle it according to your application's logic.
Hope that solves your query!