From 4ddd4e856a43c800227878c4b145aca15ce3f579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 14 Nov 2018 12:50:22 +0100 Subject: Ranch 1.7.0 --- .../en/ranch/1.7/manual/ranch.handshake/index.html | 194 +++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 docs/en/ranch/1.7/manual/ranch.handshake/index.html (limited to 'docs/en/ranch/1.7/manual/ranch.handshake/index.html') diff --git a/docs/en/ranch/1.7/manual/ranch.handshake/index.html b/docs/en/ranch/1.7/manual/ranch.handshake/index.html new file mode 100644 index 00000000..03e09f36 --- /dev/null +++ b/docs/en/ranch/1.7/manual/ranch.handshake/index.html @@ -0,0 +1,194 @@ + + + + + + + + + + Nine Nines: ranch:handshake(3) + + + + + + + + + + + + + + + + +
+
+
+
+ +

ranch:handshake(3)

+ +

Name

+

ranch:handshake - Perform the transport handshake

+

Description

+
+
handshake(Ref)       -> handshake(Ref, [])
+handshake(Ref, Opts) -> {ok, Socket}
+
+Ref    :: ranch:ref()
+Opts   :: any()
+Socket :: any()
+
+

Perform the transport handshake.

+

This function must be called by the protocol process in order to retrieve the socket for the connection. Ranch performs the handshake necessary to give control of the socket to this process and also does the transport handshake, for example setting up the TLS connection.

+

Currently the socket can be obtained from a Protocol:start_link/4 argument and as a return value from ranch:handshake/1,2. In Ranch 2.0 the socket will only be available from ranch:handshake/1,2.

+

Arguments

+
Ref
+

The listener name.

+
+
Opts
+

Transport handshake options.

+

Allowed options depend on the transport module.

+
+
+

Return value

+

An ok tuple is returned containing the socket for the connection.

+

This function will trigger an exception when an error occurs.

+

Changelog

+
  • 1.6: Function introduced. Replaces ranch:accept_ack/1. +
  • +
+

Examples

+
Initialize the connection process
+
+
start_link(Ref, _, Transport, Opts) ->
+    Pid = proc_lib:spawn_link(?MODULE, init,
+        [Ref, Transport, Opts]),
+    {ok, Pid}.
+
+init(Ref, Transport, Opts) ->
+    {ok, Socket} = ranch:handshake(Ref),
+    loop(#state{ref=Ref, socket=Socket,
+        transport=Transport, opts=Opts}).
+
+

See also

+

ranch:start_listener(3), ranch:recv_proxy_header(3), ranch:remove_connection(3), ranch(3)

+ + + + + + +
+ +
+ + +

+ Ranch + 1.7 + Function Reference + +

+ + + +

Navigation

+ +

Version select

+ + +
+
+
+
+ + + + + + + + + -- cgit v1.2.3