From b5d4cb91f80c833795a2d87050c3674bb7aecdc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 3 Oct 2017 13:39:41 +0200 Subject: Update Hugo, docs --- docs/en/ranch/1.2/guide/embedded/index.html | 89 +- docs/en/ranch/1.2/guide/index.html | 86 +- docs/en/ranch/1.2/guide/internals/index.html | 179 ++-- docs/en/ranch/1.2/guide/introduction/index.html | 57 +- docs/en/ranch/1.2/guide/listeners/index.html | 567 ++++++------ docs/en/ranch/1.2/guide/parsers/index.html | 211 ++--- docs/en/ranch/1.2/guide/protocols/index.html | 251 +++--- docs/en/ranch/1.2/guide/ssl_auth/index.html | 309 +++---- docs/en/ranch/1.2/guide/transports/index.html | 371 ++++---- docs/en/ranch/1.2/index.html | 2 +- docs/en/ranch/1.2/manual/index.html | 66 +- docs/en/ranch/1.2/manual/ranch/index.html | 836 +++++++++--------- docs/en/ranch/1.2/manual/ranch_app/index.html | 76 +- docs/en/ranch/1.2/manual/ranch_protocol/index.html | 156 ++-- docs/en/ranch/1.2/manual/ranch_ssl/index.html | 688 +++++++-------- docs/en/ranch/1.2/manual/ranch_tcp/index.html | 538 ++++++------ .../en/ranch/1.2/manual/ranch_transport/index.html | 978 ++++++++++----------- 17 files changed, 2742 insertions(+), 2718 deletions(-) (limited to 'docs/en/ranch/1.2') diff --git a/docs/en/ranch/1.2/guide/embedded/index.html b/docs/en/ranch/1.2/guide/embedded/index.html index ac94bf2a..ff2cf499 100644 --- a/docs/en/ranch/1.2/guide/embedded/index.html +++ b/docs/en/ranch/1.2/guide/embedded/index.html @@ -7,7 +7,7 @@ - + Nine Nines: Embedded mode @@ -67,54 +67,57 @@

Embedded mode

-

Embedded mode allows you to insert Ranch listeners directly -in your supervision tree. This allows for greater fault tolerance -control by permitting the shutdown of a listener due to the -failure of another part of the application and vice versa.

-
-

Embedding

-
-

To embed Ranch in your application you can simply add the child specs -to your supervision tree. This can all be done in the init/1 function -of one of your application supervisors.

-

Ranch requires at the minimum two kinds of child specs for embedding. -First, you need to add ranch_sup to your supervision tree, only once, -regardless of the number of listeners you will use. Then you need to -add the child specs for each listener.

-

Ranch has a convenience function for getting the listeners child specs -called ranch:child_spec/6, that works like ranch:start_listener/6, -except that it doesn’t start anything, it only returns child specs.

-

As for ranch_sup, the child spec is simple enough to not require a -convenience function.

-

The following example adds both ranch_sup and one listener to another -application’s supervision tree.

-
-
Embed Ranch directly in your supervision tree
-
-
init([]) ->
-        RanchSupSpec = {ranch_sup, {ranch_sup, start_link, []},
-                permanent, 5000, supervisor, [ranch_sup]},
-        ListenerSpec = ranch:child_spec(echo, 100,
-                ranch_tcp, [{port, 5555}],
-                echo_protocol, []
-        ),
-        {ok, {{one_for_one, 10, 10}, [RanchSupSpec, ListenerSpec]}}.
-

Remember, you can add as many listener child specs as needed, but only -one ranch_sup spec!

-

It is recommended that your architecture makes sure that all listeners -are restarted if ranch_sup fails. See the Ranch internals chapter for -more details on how Ranch does it.

-
-
+

Embedded mode allows you to insert Ranch listeners directly +in your supervision tree. This allows for greater fault tolerance +control by permitting the shutdown of a listener due to the +failure of another part of the application and vice versa.

+
+

Embedding

+
+

To embed Ranch in your application you can simply add the child specs +to your supervision tree. This can all be done in the init/1 function +of one of your application supervisors.

+

Ranch requires at the minimum two kinds of child specs for embedding. +First, you need to add ranch_sup to your supervision tree, only once, +regardless of the number of listeners you will use. Then you need to +add the child specs for each listener.

+

Ranch has a convenience function for getting the listeners child specs +called ranch:child_spec/6, that works like ranch:start_listener/6, +except that it doesn’t start anything, it only returns child specs.

+

As for ranch_sup, the child spec is simple enough to not require a +convenience function.

+

The following example adds both ranch_sup and one listener to another +application’s supervision tree.

+
+
Embed Ranch directly in your supervision tree
+
+
init([]) ->
+        RanchSupSpec = {ranch_sup, {ranch_sup, start_link, []},
+                permanent, 5000, supervisor, [ranch_sup]},
+        ListenerSpec = ranch:child_spec(echo, 100,
+                ranch_tcp, [{port, 5555}],
+                echo_protocol, []
+        ),
+        {ok, {{one_for_one, 10, 10}, [RanchSupSpec, ListenerSpec]}}.
+

Remember, you can add as many listener child specs as needed, but only +one ranch_sup spec!

+

It is recommended that your architecture makes sure that all listeners +are restarted if ranch_sup fails. See the Ranch internals chapter for +more details on how Ranch does it.

+
+
+ + +