This demo has two parts. A Node.js engine runs the matchmaking and simulates the players. A Next.js dashboard shows what the engine does, step by step. Both use the PubNub Chat SDK. Every player profile, with its name, Elo rating, region, and play style, is stored in App Context.
Simulated players send a request to a regional matchmaking channel. Every five seconds, the engine takes everyone in the queue, scores each possible pair by Elo gap and region, and picks the pairing with the lowest total cost. Each pair gets a pre-lobby channel. When both players confirm, the engine opens a game lobby, plays a simulated match, and saves the new ratings. The engine reports each step on a channel the dashboard listens to. The source code is open on GitHub.