0.0.1 • Published 10 years ago

angular.io v0.0.1

Weekly downloads
6
License
MIT
Repository
github
Last release
10 years ago

angular.io

AngularJS provider for work with socket.io library.

Install

npm install angular.io

Use in HTML

Not supported in this version, to be release in next versions.

Use with browserify

var angular = require('angular');
require('angular.io')(angular);
angular.module('myApp', ['SocketIOModule']);

Configurate

  angular.module('myApp')
    .config(function(socketIOProvider) {
      var params = {
				protocol: 'http',
				host: 'localhost',
				port: 3000,
				path: '',
				sessionInit: '/auth/session'
			}
      socketIOProvider.configure(params);
    });

Send data from server and listen server events.

  angular.module('myApp')
    .controller('myController',['$scope', 'socketIO', function ($scope, socket) {
    	$scope.sendMsg = function (msg) {
    		// send any data from server
    		socket.send('msg', {msg: msg}, $scope.callback);
    	}
    	socket.on('newmsg', function(data) {
    		// use data
    	})
    });
0.0.1

10 years ago

0.0.0

10 years ago