angular-websocket
WebSockets for Angular.js
Email me if something is broken.
#How do I add this to my project?
You can download angular-websocket by:
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.min.js"></script>
<script src="app/bower_components/angular-websocket/angular-websocket.js"></script>
<script>
angular.module('YOUR_APP', [
'angular-websocket',
'controllers'
])
.config(function(WebSocketProvider){
WebSocketProvider
.prefix('')
.uri('ws://echo.websocket.org/');
});
angular.module('controllers', [])
.controller('MainCtrl', function($scope, WebSocket) {
WebSocket.onopen(function() {
console.log('connection');
});
WebSocket.onmessage(function(event) {
console.log('message: ', event.data);
});
});
</script>