Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Polling interval for xhr for socket.io 1.0

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.

like image 253
slebetman Avatar asked May 15 '15 03:05

slebetman


People also ask

Does Socket.IO use long polling?

js) and the Socket.IO client (browser, Node. js, or another programming language) is established with a WebSocket connection whenever possible, and will use HTTP long-polling as fallback.

What is XHR poll?

Xhr-polling creates new request with http header and waits for answer with http header, also sequential order.

Does Socket.IO use WSS?

Note: You can use either https or wss (respectively, http or ws ).


1 Answers

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
});
like image 113
Guillermo Mansilla Avatar answered Sep 18 '22 00:09

Guillermo Mansilla