angular-websocket icon indicating copy to clipboard operation
angular-websocket copied to clipboard

Cannot read property 'readyState' of undefined

Open qidaneix opened this issue 8 years ago • 0 comments

when I using $websocket.send() I get this error message and without any other information, what's wrong with that? here is my code:

//service
app.factory('mySock',
    ['$websocket',
        function($websocket){
            return $websocket('ws://www.cspebank.cn:8080/ws.do');
        }
    ]
);
//service
app.factory('news',
    [ 'mySock',
        function (mySock) {
            var news = {
                  mySock.send(JSON.stringify({ data: 'data' }));
            };
            return news;
        }
    ]
);
app.controller(
    'appController', [
        '$scope', 'news',
        function($scope, news){
            $scope.news = news;
        }
    ]
);

thank you!

qidaneix avatar Apr 08 '16 06:04 qidaneix