[erlang-questions] Hackney socket

Benoit Chesneau <>
Wed Dec 24 18:45:23 CET 2014


On Wed, Dec 24, 2014 at 12:40 PM, Roberto Ostinelli <>
wrote:

> Hello,
> I'm using hackney to send a HTTPS request. The server I'm connecting to
> will keep the resulting TCP connection open, so that it then becomes a
> two-way communication channel using HTTP chunk.
>
> I therefore need to retrieve the Socket from a Connection Reference, so I
> can send chunked data into it.
>
> Does anyone know what is the cleanest way to retrieve the underlying
> socket from a Connection Reference?
>
> Best,
> r.
>
>
If you want to reuse the socket and cancel the request then you can use
`hackney:cancel_request/1` . Note that you can directly send chunks using
hackney if you specify the Tranfer-Encoding header. Hackney will take care
about it. It also works if you want to stream the request.

- benoit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20141224/a4dca05e/attachment.html>


More information about the erlang-questions mailing list