angular.io

0.0.1 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i angular.io

Weekly Downloads

0

Version

0.0.1

License

MIT

Last publish

Collaborators

  • alekskorolev