title: Unable to do non blocking I/O in React PHP
body: <p>I am trying to insert a record inside database coming to a react socket server. I am lost on how to do my operation in a non blocking way</p>
  
  <pre><code>$loop = Factory::create();
  
  $server = new Server('127.0.0.1:4040', $loop);
  $database = new Database();
  
  $server-&gt;on('connection', function(ConnectionInterface $conn)  use ($database) {
      $conn-&gt;write('Welcome, you can start writing your notes now...');
  
      $conn-&gt;on('data', function($data) use ($conn, $database) {
          $database-&gt;write($data);
          $conn-&gt;write('I am supposed to execute before database write');
      });
  });
  
  $loop-&gt;run();
  </code></pre>
  
  <p>The <code>write</code> method in database has a <code>sleep(10)</code> seconds before executing the sql statement. So I am expecting the next message <code>I am supposed to..</code> should be printed immediately.</p>
  
  <p>My expectation was that when ever there is a I/O operation, the operation will be moved to Event Table and don't block the call stack. As per the definition of event loop and non blocking.</p>
  
  <p>How can I perform the same operation in non blocking way.</p>
  
  <p>Thanks</p>