aboutsummaryrefslogtreecommitdiffstats
path: root/guide/listeners.md
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-08-20 12:21:24 +0200
committerLoïc Hoguin <[email protected]>2015-08-20 12:21:24 +0200
commit52797b0610b1caf0c05e46d7b2e94d09d1ebd393 (patch)
tree62cb89d1f9142f24989c9a21d52f80f665be520c /guide/listeners.md
parent315582f0bd835205b65a99a5b4a82a278a0a2940 (diff)
downloadranch-52797b0610b1caf0c05e46d7b2e94d09d1ebd393.tar.gz
ranch-52797b0610b1caf0c05e46d7b2e94d09d1ebd393.tar.bz2
ranch-52797b0610b1caf0c05e46d7b2e94d09d1ebd393.zip
Supervised and connection process can now be different
Diffstat (limited to 'guide/listeners.md')
-rw-r--r--guide/listeners.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/guide/listeners.md b/guide/listeners.md
index 4d01544..d2f7eed 100644
--- a/guide/listeners.md
+++ b/guide/listeners.md
@@ -192,6 +192,30 @@ ranch:set_max_connections(tcp_echo, MaxConns).
The change will occur immediately.
+Using a supervisor for connection processes
+-------------------------------------------
+
+Ranch allows you to define the type of process that will be used
+for the connection processes. By default it expects a `worker`.
+When the `connection_type` configuration value is set to `supervisor`,
+Ranch will consider that the connection process it manages is a
+supervisor and will reflect that in its supervision tree.
+
+Connection processes of type `supervisor` can either handle the
+socket directly or through one of their children. In the latter
+case the start function for the connection process must return
+two pids: the pid of the supervisor you created (that will be
+supervised) and the pid of the protocol handling process (that
+will receive the socket).
+
+Instead of returning `{ok, ConnPid}`, simply return
+`{ok, SupPid, ConnPid}`.
+
+It is very important that the connection process be created
+under the supervisor process so that everything works as intended.
+If not, you will most likely experience issues when the supervised
+process is stopped.
+
Upgrading
---------