An Erlang HTTP client built on gun with out-of-the-box support for Server-sent Events (SSE).
Shotgun is an Erlang HTTP client library built on top of gun, designed to simplify making HTTP requests and consuming Server-sent Events (SSE). It provides a higher-level API that handles raw message parsing and event construction, reducing repetitive code when working with SSE endpoints.
Erlang developers who need to interact with HTTP APIs, especially those consuming real-time data via Server-sent Events.
Developers choose Shotgun for its out-of-the-box SSE support and simplified API, which abstracts the complexity of gun while retaining its power, making it ideal for real-time data consumption without low-level boilerplate.
For the times you need more than just a gun.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides built-in parsing and queuing for Server-sent Events, as demonstrated by the parse_event/1 function and async_mode sse option that buffers and splits events automatically.
Offers straightforward functions like get/3 and post/5 that abstract gun's complexity, reducing boilerplate for common requests, as shown in the regular requests example.
Enables async requests for chunked responses and real-time event processing via options maps, allowing flexible handling with binary or sse modes.
Integrates basic auth seamlessly by specifying credentials in headers, as illustrated in the usage example with basic_auth entry.
Async mode is restricted to GET requests only, which constrains its utility for other HTTP methods that might benefit from asynchronous handling, as admitted in the README.
The events/1 function consumes and clears the event queue upon each call, leading to potential missed events if not handled carefully, a design flaw noted in the documentation.
Requires Erlang 17 or higher due to reliance on maps, making it incompatible with legacy systems without upgrades, limiting adoption in older environments.