title: Socket.io only emits event sometimes
body: <p>I am using React Native to connect to Socket.io with a Node.js. As far as I'm aware, the fact that I'm using React Native is more or less indifferent, besides the fact that it means I must set <code>transports: ['websocket']</code> when connecting.</p>
  
  <p>On the back-end, when prompted, the server fetches data from an API and then emits that data to a room via something similar to the following code:</p>
  
  <pre><code>async getData() {
      const data = await fetchData();
      io.of('/namespace').to('/room').emit('event', data);
  }
  </code></pre>
  
  <p>The problem is that the event only seems to be emitted about 40% of the time or so.</p>
  
  <p>I configured socket.io to log everything in the terminal. When the data transfer doesn't work, it looks like this: <code>socket.io-parser encoding packet [the data]</code>, then it says <code>socket.io-parser encoded [the data]</code> and doesn't log anything after that. When it does work, these two things are logged, but then it also logs <code>socket.io:client writing packet [the data]</code> afterwards. Another note is that all communications in which the server doesn't first have to fetch data from the API seems to be working correctly. I would appreciate if anybody had any ideas on how to resolve this, or any steps I could take to find a solution.</p>