javascript - How to add socket.io to my gruntfile.js -
i have gruntfile.js generated automatically , add socket.io (it client part working). have tried this but, not working.
this gruntfile.js
grunt.initconfig({ connect: { options: { port: 9000, hostname: '0.0.0.0', livereload: 35729, oncreateserver: function(){ var io = require('socket.io').listen(server); console.log("new sever ----------------------------------------"); } }, livereload: { options: { open: true, middleware: function (connect) { return [ connect.static('.tmp'), connect().use( '/bower_components', connect.static('./bower_components') ), connect().use( '/app/styles', connect.static('./app/styles') ), connect.static(appconfig.app) ]; } } }, test: { options: { port: 9001, middleware: function (connect) { return [ connect.static('.tmp'), connect.static('test'), connect().use( '/bower_components', connect.static('./bower_components') ), connect.static(appconfig.app) ]; } } }, dist: { options: { open: true, base: '<%= yeoman.dist %>' } } } });
how can introduce socket.io in project ?
you can take socket.io client file socket.io cdn, @ address https://cdn.socket.io/socket.io-1.4.5.js.
you don't have take if running server.
Comments
Post a Comment