title: Connecting bluetooth devices with React-Native App
body: <p>I am using react-native-bluetooth-serial. I get this error whenever I try to connect a bluetooth device via my react native app:</p>
  
  <p>Error: read failed, socket might closed or timeout, read ret: -1
  Unable to connect to device</p>
  
  <p>Here's what I'm trying to do:</p>
  
  <pre><code> connectToDevice () {
      if (this.state.discovering) {
        return false
      } else {
        this.setState({ discovering: true })
        console.log("searching");
        BluetoothSerial.list()
        .then((Devices) =&gt; {
          this.setState({ Devices, discovering: false })
          for(var i = 0; 1; i++)
          {
            if(Devices[i]["name"] == "JBL Flip 3 SE")
            {
              console.log(Devices[i]["id"]);
              BluetoothSerial.connect(Devices[i]["id"]).then((res) =&gt; {
                console.log(res);
              }).catch(err =&gt; {
                console.log(err);
              })
              break;
            }
          }
          // console.log(unpairedDevices);
        })
        .catch((err) =&gt; console.log(err.message))
      }
  }
  </code></pre>
  
  <p>Same happens even when I clone the example repository.</p>
  
  <p>Any idea why this is happening?</p>