我使用socket.io v.1.0.3. 并尝试配置生产. 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
并尝试配置生产.
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实例没有配置的错误
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);
});
