Gun Function Reference


gun - HTTP/1.1, HTTP/2 and Websocket client for Erlang/OTP


Gun is an HTTP client for Erlang/OTP with support for the HTTP/1.1, HTTP/2 and Websocket protocols.

Gun aims to provide an easy to use, asynchronous and always-connected client. It maintains a permanent connection to the server and reconnects automatically when necessary.



  • cowlib(7) - Support library for manipulating Web protocols
  • ssl - Secure communication over sockets

All these applications must be started before the gun application. To start Gun and all dependencies at once:

{ok, _} = application:ensure_all_started(gun).


The gun application does not define any application environment configuration parameters.

See also


Gun 2.1 Function Reference


Version select

Like my work? Donate!

Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and 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.