sock(Req :: cowboy_req:req()) -> Info Info :: {inet:ip_address(), inet:port_number()}
cowboy_req:sock - Socket address and port
sock(Req :: cowboy_req:req()) -> Info Info :: {inet:ip_address(), inet:port_number()}
Return the socket's IP address and port number.
The socket information can also be obtained using pattern matching:
#{sock := {IP, Port}} = Req.
The Req object.
The socket's local IP address and port number.
{IP, Port} = cowboy_req:sock(Req).
Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:
Recurring payment options are also available via GitHub Sponsors. These funds are used to cover the recurring expenses like food, dedicated servers or domain names.