How to Implement a Multiplayer Matchmaking Server Without Persistent Sockets?
I am building a multiplayer matchmaking game server using Express.js where:
Clients join a queue and wait for enough players.
The server periodically checks the queue and tries to create a match.
Once a match is made, the server notifies the clients with a match ID.
The server should not maintain a persistent WebSocket connection with clients.
Possible Approaches I Considered:
WebSockets: Clients connect to the server, and the server keeps them connected until matchmaking completes. (Not scalable for large numbers of clients.)
Client Polling: Clients repeatedly ask the server if they have been matched. (May cause unnecessary server load.)
Background Matchmaking Process:
Clients send a request to join the queue.
A background worker runs periodically and matches players.
Once a match is found, the server notifies clients (either via polling or webhooks).
Clients then connect to a game server instance to start the game.
I want to implement approach #3 where:
The matchmaking logic runs in the background.
The server only sends a match ID to the client when a match is found.
No persistent connection is required between server and client during matchmaking.
My Questions:
What tools or libraries should I use to handle matchmaking efficiently?
How can I notify clients when a match is found without using WebSockets?
Is Redis + BullMQ a good choice for queue management?
Any guidance or better approaches would be appreciated. Thanks!