Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set TCP backlog for WebSocketServer #794

Closed
msanders70 opened this issue Jul 27, 2016 · 0 comments · Fixed by #795
Closed

Unable to set TCP backlog for WebSocketServer #794

msanders70 opened this issue Jul 27, 2016 · 0 comments · Fixed by #795

Comments

@msanders70
Copy link

As node sets the backlog limit to 511 (see https://nodejs.org/api/net.html#net_server_listen_port_hostname_backlog_callback), the net.server.listen() call lets you set the backlog parameter. Unfortunately the ws module hides this functionality.

So, in lib/WebSocketServer.js you can change this

this._server.listen(options.port, options.host, callback);

to this

this._server.listen(options.port, options.host, options.backlog, callback);

and add this to the options

backlog: 511 (or whatever you want)

In my heavy load env, the backlog was full and this solved my issue.

It would be nice to fix this in the next ws version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant