Skip to content

alekskorolev/angular.io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
    	})
    });

About

Angular provider for work with socket.io library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published