ReqSSE (req_sse v0.1.1)

View Source

Req plugin for parsing text/event-stream messages (aka server-sent events). This plugin requires the use of into: :self and when a message is received in the process mailbox it should be given to Req.parse_message/2.

Summary

Functions

attach(request, opts \\ [])

Runs the plugin.

Usage

iex> resp =
...>   Req.new(into: :self)
...>   |> ReqSSE.attach()
...>   |> Req.get!(url: "https://api.example.com/path")
iex> Req.parse_message(resp, receive do message -> message end)
{:ok, data: [%ReqSSE.Message{}]}