Packages
pigeon
1.6.2
2.0.1
2.0.0
2.0.0-rc.3
2.0.0-rc.2
2.0.0-rc.1
2.0.0-rc.0
1.6.3
1.6.2
1.6.1
1.6.0
1.5.1
1.5.0
1.4.0
1.3.2
1.3.1
1.3.0
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.1.0-rc.1
1.1.0-rc.0
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
0.13.1
0.13.0
0.12.1
0.12.0
0.11.0
0.10.3
0.10.2
0.10.1
0.10.0
0.9.1
0.9.0
0.8.0
0.7.0
0.6.0
0.5.2
0.5.1
0.5.0
0.4.1
0.4.0
0.3.0
0.2.0
0.1.0
iOS (APNS), Android (FCM), and Amazon Android (ADM) push notifications for Elixir.
Current section
Files
Jump to
Current section
Files
lib/pigeon/http2/kadabra.ex
if Code.ensure_loaded?(Kadabra) do
defmodule Pigeon.Http2.Client.Kadabra do
@moduledoc false
@behaviour Pigeon.Http2.Client
def start do
Application.ensure_all_started(:kadabra)
end
def connect(uri, scheme, opts) do
host = "#{scheme}://#{uri}"
Kadabra.open(host, ssl: opts)
end
def send_request(pid, headers, data) do
Kadabra.request(pid, headers: headers, body: data)
end
@doc ~S"""
send_ping/1 implementation
## Examples
iex> {:ok, pid} = Kadabra.open("https://http2.golang.org")
iex> Pigeon.Http2.Client.Kadabra.send_ping(pid)
:ok
"""
def send_ping(pid) do
Kadabra.ping(pid)
end
def handle_end_stream({:end_stream, stream}, _state) do
%{id: id, status: status, headers: headers, body: body} = stream
pigeon_stream = %Pigeon.Http2.Stream{
id: id,
status: status,
headers: headers,
body: body
}
{:ok, pigeon_stream}
end
def handle_end_stream(msg, _state) do
msg
end
end
end