title: Getting 404 error while connecting to signalr using Angularjs
body: <p>Hi All i'm working on Implementing a SignalR Stock Ticker Using AngularJS based on an example over here. But i'm getting an error while connecting to signalr like this <strong>GET <a href="http://localhost:9000/signalr/negotiate?clientProtocol=1.5&amp;connectionData=%5B%7B%22name%22%3A%22stockticker%22%7D%5D&amp;_=1480526019939" rel="nofollow noreferrer">http://localhost:9000/signalr/negotiate?clientProtocol=1.5&amp;connectionData=%5B%7B%22name%22%3A%22stockticker%22%7D%5D&amp;_=1480526019939</a> 404 (Not Found)</strong></p>
  
  <p>And this is where the error is showing in my jquery file:</p>
  
  <pre><code>try {
  
       // Do send the request (this may raise an exception)
       xhr.send( options.hasContent &amp;&amp; options.data || null );
       } catch ( e ) {
  
      // #14683: Only rethrow if this hasn't been notified as an error yet
      if ( callback ) {
      throw e;
       }
       }
  </code></pre>
  
  <p>And this is my signalr-hub.js:</p>
  
  <pre><code>angular.module('SignalR', [])
  .constant('$', window.jQuery)
  .factory('Hub', ['$', function ($) {
      //This will allow same connection to be used for all Hubs
      //It also keeps connection as singleton.
      console.log("God help me");
      var globalConnections = [];
  
      function initNewConnection(options) {
          var connection = null;
          if (options &amp;&amp; options.rootPath) {
              connection = $.hubConnection(options.rootPath, { useDefaultPath: false });
          } else {
              connection = $.hubConnection();
          }
  
          connection.logging = (options &amp;&amp; options.logging ? true : false);
          return connection;
      }
  
      function getConnection(options) {
          var useSharedConnection = !(options &amp;&amp; options.useSharedConnection === false);
          if (useSharedConnection) {
              return typeof globalConnections[options.rootPath] === 'undefined' ?
              globalConnections[options.rootPath] = initNewConnection(options) :
              globalConnections[options.rootPath];
          }
          else {
              return initNewConnection(options);
          }
      }
  
      return function (hubName, options) {
          var Hub = this;
  
          Hub.connection = getConnection(options);
          Hub.proxy = Hub.connection.createHubProxy(hubName);
  
          Hub.on = function (event, fn) {
              Hub.proxy.on(event, fn);
          };
          Hub.invoke = function (method, args) {
              return Hub.proxy.invoke.apply(Hub.proxy, arguments)
          };
          Hub.disconnect = function () {
              Hub.connection.stop();
          };
          Hub.connect = function (queryParams) {
              var startOptions = {};
              if (options.transport) startOptions.transport = options.transport;
              if (options.jsonp) startOptions.jsonp = options.jsonp;
              if (angular.isDefined(options.withCredentials)) startOptions.withCredentials = options.withCredentials;
              if(queryParams) Hub.connection.qs = queryParams;
              return Hub.connection.start(startOptions);
          };
  
          if (options &amp;&amp; options.listeners) {
              Object.getOwnPropertyNames(options.listeners)
              .filter(function (propName) {
                      return typeof options.listeners[propName] === 'function';})
                  .forEach(function (propName) {
                      Hub.on(propName, options.listeners[propName]);
                  });
          }
          if (options &amp;&amp; options.methods) {
              angular.forEach(options.methods, function (method) {
                  Hub[method] = function () {
                      var args = $.makeArray(arguments);
                      args.unshift(method);
                      return Hub.invoke.apply(Hub, args);
                  };
              });
          }
          if (options &amp;&amp; options.queryParams) {
              Hub.connection.qs = options.queryParams;
          }
          if (options &amp;&amp; options.errorHandler) {
              Hub.connection.error(options.errorHandler);
          }
          if (options &amp;&amp; options.stateChanged) {
              Hub.connection.stateChanged(options.stateChanged);
          }
  
          //Adding additional property of promise allows to access it in rest of the application.
          if(options.autoConnect === undefined || options.autoConnect){
              Hub.promise = Hub.connect();    
          }
  
          return Hub;
      };
  }]);
  
  // Common.js package manager support (e.g. ComponentJS, WebPack)
  if (typeof module !== 'undefined' &amp;&amp; typeof exports !== 'undefined' &amp;&amp; module.exports === exports) {
    module.exports = 'SignalR';
  }
  </code></pre>
  
  <p>Since I'm new to signalr concept , have got lots of confusion in it. So, can anybody please help me out of this.</p>