[Libwebsockets] How to set a max number of clients

Andy Green andy at warmcat.com
Wed Oct 29 20:15:23 CET 2014

On 29 October 2014 23:55:13 GMT+08:00, Tiago Costa <tiago.rocha.alves.costa at gmail.com> wrote:
>I have a simple server, and I am currently attempting to limit the
>of clients.
>I found mention of a "MAX_CLIENTS" setting in the LWS_CALLBACK_HTTP
>description, but nowhere else.

This used to be a hard limit, but a much more flexible fd mapping scheme was contributed meaning we could get rid of it.

>Is it possible to set a maximum number of clients? If yes, how can I do

You can do what you want using the callbacks, depending on what you mean by 'client'.

Count connections in WSI_CREATE and WSI_DESTROY callbacks.

If you think there are too many connections, hang up on him at LWS_CALLBACK_FILTER_NETWORK_CONNECTION


>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org

More information about the Libwebsockets mailing list