Socket.ioconfiguration错误
我使用socket.io v.1.0.3。
并尝试configuration生产。
var io = require('socket.io')(server); io.configure('production', function() { log(" set config for production"); io.enable('browser client minification'); // send minified client io.enable('browser client etag'); // apply etag caching logic based on version number io.enable('browser client gzip'); // gzip the file io.set('log level', 1); // reduce logging io.set('transports', [ // enable all transports (optional if you want flashsocket) 'websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling' ]); });
一个错误说socket.io实例没有configure
io.configure('production', function() ^ TypeError: Object #<Server> has no method 'configure'
怎么样?
谢谢。
我试图在heroku上运行我的应用程序时遇到了这个问题,因为heroku不允许您使用websockets atm。 在on事件中设置传输协议对我有用。
io.on('connection', function () { io.set("transports", ["xhr-polling"]); io.set("polling duration", 10); });
- 无法parsingSourceMap:angular-route.min.js.map
- 尝试在使用Webpack作为模块Bundler的nodejs应用程序中使用mongoose
- Visual Studio 2013cordova应用程序生成错误 – 冻结
- 为什么Meteor.users.findOne({username:“test”})返回一个对象,但用具有相同值的variablesreplace“test”会返回undefined
- RabbitMQ:是否有可能删除队列时,他们是空的?
- 创build节点红色的二进制有效载荷
- passport.initialize()中间件不用于Express 4.10自定义callback
- 用mongoose更新“过期”
- 节点js服务器。 httpstatus – 404