AngularJS provider for work with socket.io library.
Not supported in this version, to be release in next versions.
var angular = require('angular');
require('angular.io')(angular);
angular.module('myApp', ['SocketIOModule']);
angular.module('myApp')
.config(function(socketIOProvider) {
var params = {
protocol: 'http',
host: 'localhost',
port: 3000,
path: '',
sessionInit: '/auth/session'
}
socketIOProvider.configure(params);
});
angular.module('myApp')
.controller('myController',['$scope', 'socketIO', function ($scope, socket) {
$scope.sendMsg = function (msg) {
socket.send('msg', {msg: msg}, $scope.callback);
}
socket.on('newmsg', function(data) {
})
});