Server-side Communication with a Match or Stream

Hey, so I’m trying to design a large real time tournament/bracket of sorts:

In a tournament, many (up to a few thousand) users are participating:

  • The tournament is broken into many small matches, each that have maybe 5-10 players
  • If, within the match, a user gets knocked out/quits, the size of that match is reduced
  • If two different matches, combined, get sufficiently small, they can “merge” into their own independent match
  • Eventually, over time, all of these matches are going to combine into a single match until a single user is left

Initial Implementation

The way I’ve currently designed this is to have a single custom stream that contains all of the users that are participating in a tournament This stream will allow users to query the status/information about the tournament, such as the number of players, stats, etc.

When a tournament begins, many Nakama matches can be created. To give information to these matches, the storage engine can be used in a read-only mechanism by the matches to retrieve information about the state, and who the players intended for that match are supposed to be.

However, I’m having trouble with the second/third bullet points mentioned above:


When a user gets knocked out/disconnected, how can I reliably let the socket/tournament get informed and subsequently process that? I can’t rely on users to properly report. A way to report information from the match back to the parent stream would be helpful, as a means to display live stats, as well as to manage the lifecycle events of the matches.

Attempted Solution

The only way I can think of that wouldn’t require having something in memory (which defeats the distributed nature of Nakama) would be to poll the storage engine, which sounds like a poor design choice. However, I’m having trouble coming up with/designing a separate solution altogether with something like Redis.

I came across Communication between matches?, however this doesn’t actually seem to provide a way I could communicate between different matches or with a stream from a server. I’d appreciate any thoughts on a way to imlpement this