title: SignalR - connection.start failed
body: <p>I try to run the tutorial from <strong>Anthony Chu</strong>.
  <a href="https://www.youtube.com/watch?v=4d0wor7uAgQ" rel="nofollow noreferrer">https://www.youtube.com/watch?v=4d0wor7uAgQ</a></p>
  <p>He implemented a &quot;SimpleChat-Application&quot; with Azure CosmosDB, Azure Functions and SignalR. Where you can send messages between Clients in Realtime.
  I tried different settings and version but i can´t make it work.</p>
  <p><strong>Source Code in my &quot;index.html&quot;: (JavaScript)</strong></p>
  <pre><code>  &lt;script src=&quot;https://unpkg.com/@aspnet/signalr@1.0.0-rc1-final/dist/browser/signalr.js&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;https://unpkg.com/axios/dist/axios.min.js&quot;&gt;&lt;/script&gt;
    
    &lt;script&gt;
      const apiBaseUrl = 'http://localhost:7071';
      const hubName = 'chat';
      getConnectionInfo().then(info =&gt; {      
        let username;
        while (!username &amp;&amp; username !== null) {
          username = prompt('Enter a username');
        }
        console.log(info.accessTokenFactory);
        if (username === null) return;
        document.body.classList.add('ready');
        const messageForm = document.getElementById('message-form');
        const messageBox = document.getElementById('message-box');
        const messages = document.getElementById('messages');
        const options = {
          accessTokenFactory: () =&gt; info.accessKey
        };
  
        const connection = new signalR.HubConnectionBuilder()
          .withUrl(info.url, options)
          .configureLogging(signalR.LogLevel.Trace)
          .build();
  
        connection.onclose(() =&gt; console.log('disconnected'));
  
        console.log('retrieving messages');
  
        getMessage().then(messages =&gt; {
          for(let m of messages) {
            newMessage(m);
          }
          console.log('connecting...');
          connection.start()
            .then(() =&gt; console.log('connected!'))
            .catch(console.error);
        });
        console.log('connected after');
      }).catch(alert);
      
      function getConnectionInfo() {
        console.log(&quot;test&quot;);
        return axios.post(`${apiBaseUrl}/api/negotiate`)
          .then(resp =&gt; resp.data);
      }
  
      function getMessage(sender, messageText) {
        return axios.get(`${apiBaseUrl}/api/getmessage`).then(resp =&gt; resp.data);
      }
  
      function newMessage(message) {
        const newMessage = document.createElement('li');
        newMessage.appendChild(document.createTextNode(`${message.sender}: ${message.text}`));
        messages.prepend(newMessage);
      }
    &lt;/script&gt;
  </code></pre>
  <p><strong>Source Code (negotiate - function.json)</strong></p>
  <pre><code>{
    &quot;disabled&quot;: false,
    &quot;bindings&quot;: [
      {
        &quot;authLevel&quot;: &quot;anonymous&quot;,
        &quot;type&quot;: &quot;httpTrigger&quot;,
        &quot;direction&quot;: &quot;in&quot;,
        &quot;name&quot;: &quot;req&quot;
      },
      {
        &quot;type&quot;: &quot;http&quot;,
        &quot;direction&quot;: &quot;out&quot;,
        &quot;name&quot;: &quot;res&quot;
      },
      {
        &quot;type&quot;: &quot;signalRConnectionInfo&quot;,
        &quot;name&quot;: &quot;connectionInfo&quot;,
        &quot;hubName&quot;: &quot;chat&quot;,
        &quot;connectionStringSetting&quot;: &quot;AzureSignalRConnectionString&quot;, 
        &quot;direction&quot;: &quot;in&quot;
      }
    ]
  }
  </code></pre>
  <p><strong>Source Code (negotiate - index.js)</strong></p>
  <pre><code>module.exports = function (context, req, connectionInfo) {
      context.res = { body: connectionInfo };
      context.done();
  }
  </code></pre>
  <p>I can receive data from the cosmosDB but when i come to the connection.start() method... it didn´t connect to the Service?!</p>
  <p>Can anybody help me?</p>
  <p>Many Thanks!!!</p>
  <p><strong>Versions:</strong></p>
  <ul>
  <li><p>Func(2.2.70)</p>
  </li>
  <li><p>Microsoft.Azure.WebJobs.Extensions.SignalRService (1.0.0-preview1-10002)</p>
  </li>
  <li><p>Microsoft.Azure.WebJobs.Extensions.CosmosDB (3.0.2)</p>
  </li>
  <li><p>Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator (1.0.1)</p>
  </li>
  </ul>
  <p>(&quot;Me: Hallo&quot; is an entry in the CosmosDB)</p>
  <p><a href="https://i.stack.imgur.com/iHCOP.png" rel="nofollow noreferrer">Result Page with Console-Log</a></p>