title: How can I redirect all clients to another page with socket.io?
body: <p>I am working on an online multiplayer cards against humanity game (React on the front, React router for redirecting, and Node in the back) I am trying to redirect all clients in a "lobby", or room, when one user in the lobby clicks "start", but right now only the user that clicks start is redirected.  </p>
  
  <p>The idea is somebody will set up a new game, which will have a unique pin, where after you create the game and select your avatar, others can use that pin the join the lobby (this part is working fine, the users in the lobby are updated in real time for all users), and only the person who created the game will get a "start" button to click to start the game once all the users have joined, which should redirect all the users in the lobby. </p>
  
  <p>On the client side, in the Lobby component's constructor, I have </p>
  
  <pre><code>   socket.on("start game", () =&gt; {
        this.props.history.push(`/${this.props.match.params.pin}`);
      });
  </code></pre>
  
  <p>And for the one user who has access to the start button, the following is triggered when it is clicked</p>
  
  <pre><code>socket.emit("start");
  </code></pre>
  
  <p>Which then goes to the backend</p>
  
  <pre><code>   socket.on('start', () =&gt; { 
          socket.emit('start game');
      })
  </code></pre>
  
  <p>But only the user who clicked start is being redirected, and I cant seem to figure this out.</p>
  
  <p>This is my first time trying to implement sockets and I'm not so sure what I can be missing here</p>