# Httpc: send multiple requests using the same connection

**URL:** <https://erlangforums.com/t/httpc-send-multiple-requests-using-the-same-connection/2685>\
**Category:** Questions / Help\
**Tags:** httpc, keepalive\
**Created:** [June 12, 2023, 2:05pm UTC](https://erlangforums.com/t/httpc-send-multiple-requests-using-the-same-connection/2685 "2023-06-12T14:05:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zabrane](https://erlangforums.com/letter_avatar_proxy/v4/letter/z/7ba0ec/32.png) [@zabrane](https://erlangforums.com/u/zabrane)\
**Post date:** [June 12, 2023, 2:05pm UTC](https://erlangforums.com/t/httpc-send-multiple-requests-using-the-same-connection/2685/1 "2023-06-12T14:05:16Z")

</div>

Hi guys,

I’m currently using [httpc](https://www.erlang.org/doc/man/httpc.html) to fetch `3x JSON` data.  
For every JSON, I’m calling `httpc:request/4`. Not sure if it’s the best way :-/

Ideally, I’d like to reuse the same connection for all `3x requests`.

How can i make sure the TCP connection is not closed ([Keep-Alive](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive))?

Best

---

<div class="post-metadata">

**Author:** ![Led](https://erlangforums.com/user_avatar/erlangforums.com/led/32/1594_2.png) [@Led](https://erlangforums.com/u/Led)\
**Post date:** [June 16, 2023, 11:38am UTC](https://erlangforums.com/t/httpc-send-multiple-requests-using-the-same-connection/2685/2 "2023-06-16T11:38:27Z")

</div>

```erlang
httpc:set_options([..., {keep_alive_timeout, KeepAliveTimeoutMS},...]).

```

But AFAIR keep-alive is only request to server and server may ignore it.

---

<div class="post-metadata">

**Author:** ![zabrane](https://erlangforums.com/letter_avatar_proxy/v4/letter/z/7ba0ec/32.png) [@zabrane](https://erlangforums.com/u/zabrane)\
**Post date:** [June 16, 2023, 5:23pm UTC](https://erlangforums.com/t/httpc-send-multiple-requests-using-the-same-connection/2685/3 "2023-06-16T17:23:27Z")

</div>

@Led thank you very much
