angular-websocket
angular-websocket copied to clipboard
Cannot read property 'readyState' of undefined
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!