Packages
pigeon
0.13.0
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
57 Versions
Jump to
Current section
57 Versions
Compare versions
6
files changed
+12
additions
-18
deletions
| @@ -33,4 +33,4 @@ | |
| 33 33 | {<<"name">>,<<"chatterbox">>}, |
| 34 34 | {<<"optional">>,true}, |
| 35 35 | {<<"requirement">>,<<"~> 0.4.0">>}]]}. |
| 36 | - {<<"version">>,<<"0.12.1">>}. |
| 36 | + {<<"version">>,<<"0.13.0">>}. |
| @@ -96,7 +96,8 @@ defmodule Pigeon.APNS do | |
| 96 96 | cert: Config.cert(opts[:cert]), |
| 97 97 | certfile: Config.file_path(opts[:cert]), |
| 98 98 | key: Config.key(opts[:key]), |
| 99 | - keyfile: Config.file_path(opts[:key]) |
| 99 | + keyfile: Config.file_path(opts[:key]), |
| 100 | + ping_period: opts[:ping_period] || 600_000 |
| 100 101 | } |
| 101 102 | Pigeon.APNSWorker.start_link(config) |
| 102 103 | end |
| @@ -14,7 +14,8 @@ defmodule Pigeon.APNS.Config do | |
| 14 14 | certfile: file_path(config[:cert]), |
| 15 15 | key: key(config[:key]), |
| 16 16 | keyfile: file_path(config[:key]), |
| 17 | - use_2197: config[:use_2197] || false |
| 17 | + use_2197: config[:use_2197] || false, |
| 18 | + ping_period: config[:ping_period] || 600_000 |
| 18 19 | } |
| 19 20 | end |
| @@ -1,12 +1,10 @@ | |
| 1 1 | defmodule Pigeon.APNSWorker do |
| 2 2 | @moduledoc """ |
| 3 | - Handles all APNS request and response parsing over an HTTP2 connection. |
| 3 | + Handles all APNS request and response parsing over an HTTP2 connection. |
| 4 4 | """ |
| 5 5 | use GenServer |
| 6 6 | require Logger |
| 7 7 | |
| 8 | - @ping_period 600_000 # 10 minutes |
| 9 | - |
| 10 8 | defp apns_production_api_uri, do: "api.push.apple.com" |
| 11 9 | defp apns_development_api_uri, do: "api.development.push.apple.com" |
| 12 10 | |
| @@ -32,7 +30,7 @@ defmodule Pigeon.APNSWorker do | |
| 32 30 | mode = config[:mode] |
| 33 31 | case connect_socket(config, 0) do |
| 34 32 | {:ok, socket} -> |
| 35 | - Process.send_after(self(), :ping, @ping_period) |
| 33 | + Process.send_after(self(), :ping, config[:ping_period]) |
| 36 34 | {:ok, %{ |
| 37 35 | apns_socket: socket, |
| 38 36 | mode: mode, |
| @@ -263,7 +261,7 @@ defmodule Pigeon.APNSWorker do | |
| 263 261 | |
| 264 262 | def handle_info(:ping, state) do |
| 265 263 | Pigeon.Http2.Client.default().send_ping(state.apns_socket) |
| 266 | - Process.send_after(self(), :ping, @ping_period) |
| 264 | + Process.send_after(self(), :ping, state.config.ping_period) |
| 267 265 | |
| 268 266 | {:noreply, state} |
| 269 267 | end |
| @@ -2,21 +2,15 @@ defmodule Pigeon.Http2.Client.Kadabra do | |
| 2 2 | @behaviour Pigeon.Http2.Client |
| 3 3 | |
| 4 4 | def connect(uri, scheme, opts) do |
| 5 | - if Code.ensure_loaded?(Kadabra) do |
| 6 | - Kadabra.open(uri, scheme, opts) |
| 7 | - end |
| 5 | + Kadabra.open(uri, scheme, opts) |
| 8 6 | end |
| 9 7 | |
| 10 8 | def send_request(pid, headers, data) do |
| 11 | - if Code.ensure_loaded?(Kadabra) do |
| 12 | - Kadabra.request(pid, headers, data) |
| 13 | - end |
| 9 | + Kadabra.request(pid, headers, data) |
| 14 10 | end |
| 15 11 | |
| 16 12 | def send_ping(pid) do |
| 17 | - if Code.ensure_loaded?(Kadabra) do |
| 18 | - Kadabra.ping(pid) |
| 19 | - end |
| 13 | + Kadabra.ping(pid) |
| 20 14 | end |
| 21 15 | |
| 22 16 | def handle_end_stream({:end_stream, %{id: id, |
Loading more files…