From e7feea1ec8a65311f9da998605031df77e5d26ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 25 Jun 2020 13:32:01 +0200 Subject: Ranch 2.0 --- docs/en/ranch/2.0/guide/protocols/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/en/ranch/2.0/guide/protocols') diff --git a/docs/en/ranch/2.0/guide/protocols/index.html b/docs/en/ranch/2.0/guide/protocols/index.html index 34817316..2388c2e8 100644 --- a/docs/en/ranch/2.0/guide/protocols/index.html +++ b/docs/en/ranch/2.0/guide/protocols/index.html @@ -64,7 +64,7 @@

A protocol handler starts a connection process and defines the protocol logic executed in this process.

Writing a protocol handler

-

All protocol handlers must implement the ranch_protocol behavior which defines a single callback, start_link/3. This callback is responsible for spawning a new process for handling the connection. It receives four arguments: the name of the listener, the socket, the transport handler being used and the protocol options defined in the call to ranch:start_listener/5. This callback must return {ok, Pid}, with Pid the pid of the new process.

+

All protocol handlers must implement the ranch_protocol behavior which defines a single callback, start_link/3. This callback is responsible for spawning a new process for handling the connection. It receives three arguments: the name of the listener, the transport handler being used and the protocol options defined in the call to ranch:start_listener/5. This callback must return {ok, Pid}, with Pid the pid of the new process.

The newly started process can then freely initialize itself. However, it must call ranch:handshake/1,2 before doing any socket operation. This will ensure the connection process is the owner of the socket. It expects the listener's name as argument.

Perform the socket handshake