5

How do I set the polling interval for xhr fallback for socket.io 1.0? It looks like it polls every second when not in websocket mode but I'd prefer if the polling interval is every 2 seconds to reduce load on the server.

I read through the documentation for both socket.io and engine.io about the options object but couldn't find anything in there that would set polling interval.

slebetman
  • 109,858
  • 19
  • 140
  • 171

1 Answers1

6
io.set("polling duration", 2);

Although "set" is gone. So I think that you will have to do it in Server initialization

var socket = require('socket.io')({
    "polling duration": 2
});
Guillermo Mansilla
  • 3,779
  • 2
  • 29
  • 34
  • The options object passed to the server initialization code looks like it doesn't support "polling duration". Fortunately the `io.set` still works. I see now in the docs that it's supported for backwards compatibility but is deprecated. I guess I just won't update the code when socket.io finally drops support for it. – slebetman May 17 '15 at 01:47