Reputation: 1389
I was using only xhr-polling on socket.io v0.9 but now in 1.0 I couldn't find this option.You know antiviruse bans the websocket so I want to use xhr-polling.How can I achive this ?
Upvotes: 4
Views: 5645
Reputation: 707416
Several examples on how to set the allowed socket.io transports here: https://github.com/Automattic/socket.io/wiki/configuring-socket.io
Here are some of the:
var io = require('socket.io').listen(80);
io.configure('production', function(){
io.enable('browser client etag');
io.set('log level', 1);
io.set('transports', [
'websocket'
, 'flashsocket'
, 'htmlfile'
, 'xhr-polling'
, 'jsonp-polling'
]);
});
io.configure('development', function(){
io.set('transports', ['websocket']);
});
or just this:
// enable all transports (optional if you want flashsocket support, please note that some hosting
// providers do not allow you to create servers that listen on a port different than 80 or their
// default port)
io.set('transports', [
'xhr-polling'
]);
Or, options can be set when the server is initialized:
var socket = require('socket.io').listen(80, {
// options can go here
transports: ['xhr-polling']
});
Upvotes: 4