Title: 'Unknown Provider' trying to Include angular-websocket in a MeanJS v0.4.1 app
Tags: javascript;angularjs;node.js;meanjs
Question: I am having a bit of difficulty using angular-websocket in a controller in a MeanJS application I am working on.

My Application is based on MeanJS v0.4.1.

I first installed it with:

```    bower install angular-websocket --save    
```

This created the directory /public/lib/angular-websocket

Next I added it to /config/assets/default.js

```    lib: {
      css: [
        ...
      ],
      js: [
        ...
        'public/lib/angular-websocket/angular-websocket.js'
      ],
      tests: ['public/lib/angular-mocks/angular-mocks.js']
    },
```

In my /modules/core/client/app/config.js file I have added it as a dependency:

```    var applicationModuleVendorDependencies = [
        ...
        'angular-websocket'
    ];
```

And finally in my angular module itself, 

```    angular.module('somemodule').controller('ModulenameController', ['$scope', '$http', '$stateParams', '$location', 'Authentication', 'SomeModule', 'ngWebSocket',
        function ($scope, $http, $stateParams, $location, Authentication, SomeModule, ngWebSocket) {
```

When I go to view my page I can see in the "Sources" tab of Chrome's Developer tools that it is included as a source,

I am trying to use this file with something like this in my controller:

```    var dataStream = ngWebSocket('wss://www.somesite.com/realtime');

    dataStream.onMessage(function(message) {
        console.log("dataStream Message: " + message);
        $scope.orderBook = message;
    });

    dataStream.send('{"op":"subscribe", "args":"someargument"}');
```

However, my console shows the following error:

```Error: [$injector:unpr] Unknown provider: ngWebSocketProvider <- ngWebSocket <- ModuleNameController
```

Some of the things I have tried:


Changing The Reference Name
As per the documentation (https://www.npmjs.com/package/angular-websocket) 

```angular.module('YOUR_APP', [
  'ngWebSocket' // you may also use 'angular-websocket' if you prefer
])
```


I've tried using 'ngWebSocket', 'angular-websocket', but I still get the same issue.


I've tried looking through my code to see if maybe this was being redefined as the angularJS documentation here: 

https://docs.angularjs.org/error/$injector/unpr


states that a cause of this error could be 'redefining a module using the angular.module API'.

Any help would be greatly appreciated.


Here is the accepted answer: The factory is actually named ```$websocket```, so you should do as follows:

``` angular.module('somemodule').controller('ModulenameController', ['$scope', '$http', '$stateParams', '$location', 'Authentication', 'SomeModule', '$websocket',
    function ($scope, $http, $stateParams, $location, Authentication, SomeModule, $websocket) {
```

Comment for this answer: No problem! glad to help :)
Comment for this answer: Thanks! This Worked! I'll accept your answer in 8 minutes


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:10/09/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<javascript><angularjs><node.js><meanjs>', 'Title': "'Unknown Provider' trying to Include angular-websocket in a MeanJS v0.4.1 app", 'ViewCount': 650, 'id': 33042784, 'user_AboutMe': '', 'user_AccountId': 6792154.0, 'user_DisplayName': 'Dave Rich', 'user_Reputation': 319.0, 'user_Views': 24.0, 'user_id': 5228899.0}}