Domanda

Is anyone aware how to configure nagle's algorithm (on or off) while using socket.io?
Is this option even provided with socket.io?
I am assuming that the default behavior is configured to use nagle's algorithm (please correct me if I am wrong).

I would ideally like to configure nagle's algo (on/off) while using socket.io as needed in different applications - regardless of which web/app server I may be using.

Thanks!

È stato utile?

Soluzione

As per Guillermo Rauch, Nagle's algorithm is turned off by default for web sockets in socket.io. I will submit a request to make this configurable (hopefully this will be looked at in a future release).

Thanks Guillermo.

Altri suggerimenti

The nagle algorithm can be switched of

int socket_descriptor;  
BOOL bOptVal = TRUE;
int bOptLen = sizeof(BOOL);
// get a socket:
socket_descriptor = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
/* ... bind the socket, listen to it
    .
    .
*/
// set the socket to non-blocking mode:
ioctlsocket(socket_descriptor, FIONBIO, 1);

// disable nagle:
setsockopt(socket_descriptor, IPPROTO_TCP, TCP_NODELAY, (char*)&bOptVal, bOptLen);

Edit: in .NET it is the Socket.NoDelay property.

in socket.io the nagle algorithm is already disabled for websockets and disabling it for other transports is beeing discussed (as of April 2012).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top