title: Creating match rooms with firebase
body: <p>Im building a game where some k number of people can play, live</p>
  
  <p>Im using firebase for sharing user-related data and obtaining updates from a backend nodeJS on heroku. So far so good, but I have one major requirement that I havent yet fully figured out to build using firebase and a NodeJS backend</p>
  
  <p>There could be potentially a large number of users wanting a play a game. I'd like to match k of these users and assign them a unique gameroom id, where they can then 'play' . For the sake of this question we can omit what the actual 'play' is.</p>
  
  <p>So I'd like to create a random set of k users and here is how Im thinking of approaching it, I'd like to know if this is a good approach or a terrible approach. I'd also like more suggestions if there is an easier way to achieve this:</p>
  
  <ol>
  <li>Live players indicate on my Firebase store that they'd like to play
  using a state variable</li>
  <li>A NodeJS backend on Heroku runs every few seconds to ensure that the system
  has a good 'mix' of players. When it runs, it uses the <a href="https://www.firebase.com/docs/rest/api/" rel="nofollow">Firebase REST
  API</a> to pull up <em>all</em> the waiting Live players (is this a good idea?)</li>
  <li>It then sections off these live players to a <a href="https://github.com/firebase/firebase-queue" rel="nofollow">Firebase Queue</a>. It does
  this by taking 1000*k live users and creating 1 task. Thus it may
  create many such tasks with 1000*k users in each task.</li>
  </ol>
  
  <p>I'd like to add that if there was a way for a single queue worker to access multiple tasks then I would much prefer that. In that case Step 2 is pretty much not required, since the live players can add themselves to the queue and a single worker can access k of these users to match them together - is this possible with the current Firebase Queue??</p>
  
  <ol start="4">
  <li>Queue workers pick up a task and make 1000 matches and write these
  match details in the players node in firebase</li>
  <li>Players waiting on their node are now matched with a unique gameroom
  id and k other players</li>
  </ol>