Amaterasu
Amaterasu

Reputation: 396

Set Socket.IO polling frequency?

Is there any way to set (i. e. reduce) the polling frequency for Socket.IO (v4.4) when using the long polling transport? Either on the server or the client?

The long polling transport is described in the documentation, and usually acts as a fallback (but can be explicitly set) when a WebSocket connection cannot be established:

The bidirectional channel between the Socket.IO server (Node.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.

Upvotes: 4

Views: 2249

Answers (1)

Sive
Sive

Reputation: 124

Short answer: No Long answer: Well that's not how Socket.io works. It doesn't "poll" That would defeat the whole purpose of increased performing and whatnot. What socket.io does on the client is wait for the server to send data. It doesn't ask the server for it. Same thing to send messages. And the exact same thing on the server. Which is why you don't have to bother with the poll rate.

Upvotes: 1

Related Questions