Plug and HTTP Persistent Connections

Hi everyone,

I was wondering how Plug deals with HTTP persistent connections?

I have looked through the documentation but I can’t find anything mentioning it. I fear this means that the answer might be that “it doesn’t”. If it doesn’t then what Elixir/Erlang HTTP client and server can I use to get persistent connections?

Thanks in advance,

Matthew

1 Like

That’s completely up to the web server. Cowboy, which is what Plug uses by default, will use keep-alive when possible unless you explicitly close the connection (or the current request fails).

1 Like

@josevalim Sorry to hijack the thread but what about Websocket and/or HTTP2? They are not simply reusing the socket for req/res cycles. They are channels. Will the Phoenix Channel API be ported to Plug once cowboy 2.0 final is out?

Thanks :slight_smile:

1 Like

Thanks,

I will have a look at the underlying web server.

I am really enjoying learning Elixir. I think you have done a fantastic job. Keep going!

Regards,

Matthew

1 Like