title: How to fix " Error: Failed to start the transport 'WebSockets': null " in reactnative using @aspnet/signalr library?
body: <p>I keep getting Failed to start the transport 'WebSockets': null when connecting to server.</p>
  <p><strong>I'm implementing a simple chat in reactnative mobile app. And I'm using @aspnet/signalr(version-1.1.4) library. I am getting this error - Error: Failed to start the transport 'WebSockets': null.</strong> <strong>See logs here</strong>
  <a href="https://i.stack.imgur.com/ALkgX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ALkgX.jpg" alt="Im getting following logs in chrome" /></a></p>
  <pre><code>componentDidMount(){
  
  try {
  
        const connection = new signalR.HubConnectionBuilder() //Connect to a hub
          .withUrl(baseUrl + `/chatbus`, {
            transport: signalR.HttpTransportType.WebSockets | signalR.HttpTransportType.LongPolling,
            'content-type': 'application/json',
            accessTokenFactory: () =&gt; authToken   //for authorization
          })
          .configureLogging(signalR.LogLevel.Debug)
          .build();
  
        connection.on('NotifySignalR', (ChatObject) =&gt; {
          console.log(ChatObject);
  
        });
  
        connection.start()
          .then(() =&gt; {
            console.log('Chat Connection started.');
            console.log('Now connected, connection ID=' + connection.id);
            this.initalAttemptForChat = true;
            connection.invoke(&quot;start&quot;);
          })
          .catch(() =&gt; {
            this.initalAttemptForChat = false;
            console.log('Error while establishing chatbus connection!');
          });
  
      } catch (e) {
        console.log(&quot;error &quot;, e);
        throw e;
      }
  }
  </code></pre>