max_conns() = non_neg_integer() | infinity
ranch - Socket acceptor pool
The module ranch
provides functions for starting and manipulating Ranch listeners.
Start/stop:
Suspend/resume:
Connections:
Options:
Introspection:
max_conns() = non_neg_integer() | infinity
Maximum number of connections allowed on this listener.
This is a soft limit. The actual number of connections might be slightly above the limit due to concurrency when accepting new connections. Some connections may also be removed from this count explicitly by the user code.
opt() = {ack_timeout, timeout()} | {connection_type, worker | supervisor} | {max_connections, max_conns()} | {num_acceptors, pos_integer()} | {shutdown, timeout() | brutal_kill} | {socket, any()}
Deprecated form for Ranch-specific options.
Please use the opts()
type when you need to provide Ranch-specific transport options. Socket options will remain separate from the Ranch-specific options.
opts() = any() | #{ connection_type => worker | supervisor, handshake_timeout => timeout(), max_connections => max_conns(), logger => module(), num_acceptors => pos_integer(), shutdown => timeout() | brutal_kill, socket => any(), socket_opts => any() }
Transport options.
The transport options are a combination of Ranch-specific options and socket options. Socket options may be given directly (assuming they are not a map and no Ranch-specific option needs to be given) or as part of socket_opts
.
None of the options are required.
When ack_timeout
is found in a transport options proplist, it is converted to the handshake_timeout
option from the map. They are equivalent. The ack_timeout
option will be removed in Ranch 2.0.
Type of process that will handle the connection.
Maximum allowed time for the ranch:handshake/1,2
call to finish.
Maximum number of active connections. Soft limit. Use infinity
to disable the limit entirely.
Number of processes that accept connections.
Maximum allowed time for children to stop on listener shutdown.
Listening socket opened externally to be used instead of calling Transport:listen/1
. This option will be removed in Ranch 2.0. Use a custom transport module acting as a wrapper for ranch_tcp
or ranch_ssl
instead.
Socket options given to Transport:listen/1
. Please refer to the documentation of the transport module you are using for more details.
ref() = any()
Unique name used to refer to a listener.
logger
option was added.
opt()
type was deprecated in favor of the new opts()
type.
Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:
Recurring payment options are also available via GitHub Sponsors. These funds are used to cover the recurring expenses like food, dedicated servers or domain names.