ranch:remove_connection(3)

Name

ranch:remove_connection - Remove connection from the count

Description

remove_connection(Ref :: ranch:ref()) -> remove_connection(Ref, self())
remove_connection(Ref :: ranch:ref(), Pid :: pid()) -> ok

Remove connection from the count.

This connection will no longer be included in the count when limiting the number of connections. This can be useful in a mixed environment where some connections are active and others are passive. Passive connections spend most of their time idling and are not consuming much resources.

When connection_type is supervisor and the socket belongs to a child of the supervised process, call remove_connection/2 with that parent pid.

This function may only be called from a connection process.

Arguments

Ref

The listener name.

Pid

The pid to remove from the count.

Return value

The atom ok is always returned. It can be safely ignored.

Changelog

  • 2.4: The remove_connection/2 arity was added.

Examples

Remove the connection process from the count
ranch:remove_connection(example).
Remove a child of the supervised process from the count
ranch:remove_connection(example, Parent).

See also

ranch:start_listener(3), ranch:handshake(3), ranch(3)

Ranch 2.4 Function Reference

Navigation

Version select

Sponsor me!

Support my work on Cowboy, Ranch, Gun and Erlang.mk via GitHub Sponsors. The funds cover domain names and development tools.