text: 'use strict';
  
  // Declare app level module which depends on views, and components
  angular.module('myApp', [
    'ngRoute',
    'myApp.view1',
    'myApp.view2',
    'myApp.version',
    'SignalR'
  ]).
  config(['$routeProvider', function($routeProvider) {
    $routeProvider.otherwise({redirectTo: '/view1'});
  }])
  .factory('signalRHubProxy', ['$rootScope', 'signalRServer', function ($rootScope, signalRServer) {
      function signalRHubProxyFactory(serverUrl, hubName, startOptions) {
          var connection = $.hubConnection(signalRServer);
          var proxy = connection.createHubProxy(hubName);
          connection.start(startOptions).done(function (res) { console.log("connection done", res); }).fail(function(res){console.log(res);});
          return {
              on: function (eventName, callback) {
                  proxy.on(eventName, function (result) {
                      $rootScope.$apply(function () {
                          if (callback) {
                              callback(result);
                          }
                      });
                  });
              },
              off: function (eventName, callback) {
                  proxy.off(eventName, function (result) {
                      $rootScope.$apply(function () {
                          if (callback) {
                              callback(result);
                          }
                      });
                  });
              },
              invoke: function (methodName, callback) {
                  proxy.invoke(methodName)
                      .done(function (result) {
                          $rootScope.$apply(function () {
                              if (callback) {
                                  callback(result);
                              }
                          });
                      });
              },
              connection: connection
          };
      };
  
      return signalRHubProxyFactory;    
  }]).value('signalRServer', 'http://signalr-uszo.azurewebsites.net');