{"id":19781965,"url":"https://github.com/inaka/pushito","last_synced_at":"2025-04-30T22:30:36.726Z","repository":{"id":57538085,"uuid":"92773933","full_name":"inaka/pushito","owner":"inaka","description":"APNS over HTTP/2","archived":false,"fork":false,"pushed_at":"2017-10-10T08:02:02.000Z","size":4770,"stargazers_count":11,"open_issues_count":2,"forks_count":4,"subscribers_count":36,"default_branch":"master","last_synced_at":"2024-03-15T01:03:45.386Z","etag":null,"topics":["apns","apple","elixir","push-notifications"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inaka.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-29T20:41:51.000Z","updated_at":"2023-09-01T10:47:05.000Z","dependencies_parsed_at":"2022-09-07T16:50:21.954Z","dependency_job_id":null,"html_url":"https://github.com/inaka/pushito","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Fpushito","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Fpushito/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Fpushito/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inaka%2Fpushito/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inaka","download_url":"https://codeload.github.com/inaka/pushito/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224225339,"owners_count":17276435,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apns","apple","elixir","push-notifications"],"created_at":"2024-11-12T06:03:16.529Z","updated_at":"2024-11-12T06:03:17.000Z","avatar_url":"https://github.com/inaka.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pushito\nAPNS over HTTP/2 for Elixir. Inspired on Erlang the project [apns4erl](https://github.com/inaka/apns4erl)\n\nCopyright (c) 2017 Erlang Solutions Ltd. \u003csupport@inaka.net\u003e, released under the Apache 2 license\n\nCheck the [Online documentation](http://hexdocs.pm/pushito)\n\n**note** this project is under development\n\n## Contact Us\nIf you find any **bugs** or have a **problem** while using `Pushito`, please [open an issue](https://github.com/inaka/pushito/issues/new) in this repo (or a pull request :)).\n\nAnd you can check all of our open-source projects at [inaka.github.io](http://inaka.github.io)\n\n## Installation\n\nAdd `Pushito` to your list of dependencies:\n\n```elixir\ndef deps do\n  [{:pushito, \"~\u003e 0.1.0\"}]\nend\n```\n\nAnd start it\n\n```elixir\n[extra_applications: [:logger, :pushito]\n```\n\n## Example\n\nThere are two types of connection with APNs, `Provider Certificate` (`cert`) and `Provider Authentication Token` (`token`). The first one uses ssl certificates and the second one uses a `JWT` token per each request.\n\nFirst we need a `Pushito.Config` struct, we are going to create a `cert` type:\n\n```elixir\nimport Pushito.Config\n\nconfig = new()\n         |\u003e add_name(:my_first_connection)\n         |\u003e add_type(:cert)\n         |\u003e add_host(\"api.development.push.apple.com\")\n         |\u003e add_cert_file(\"priv/cert2.pem\")\n         |\u003e add_key_file(\"priv/key2-noenc.pem\")\n```\n\nNow we can connect to APNs:\n\n```elixir\nPushito.connect config\n```\n\nWe can push notification over that connection. First we need a `Pushito.Notification` struct:\n\n```elixir\nimport Pushito.Notification\n\nnotification = new()\n               |\u003e add_device_id(\"bd5c3ad01bbe4d884bf2fe8801ed77e94a71bc2e9de937c84f745f54eb4cb2f4\")\n               |\u003e add_topic(\"com.inaka.myapp\")\n               |\u003e add_message(%{:aps =\u003e %{:alert =\u003e \"you have a message!!\"}})\n```\n\nNow we can push it!\n\n```elixir\nPushito.push :my_connection, notification\n```\n\nIn my case I got this:\n\n```elixir\n%Pushito.Response{body: :no_body,\n headers: [{\"apns-id\", \"34F4B4F4-ADB6-982F-EB23-36632837520C\"}], status: 200}\n ```\n\n *Note* the process which calls `Pushito.connect/1` should be the same which calls `Pushito.push/2`\n\n## Important Links\n\n- [Online Documentation](http://hexdocs.pm/pushito)\n- [Full Example](examples/pusher/README.md)\n- [Pool of connections Example](examples/push_pool/README.md)\n\n## Tests\n\nFor now `pushito` tests against APNs servers without mocks. For this reason you must fill the `config/test.exs` file with your correct information:\n\n```elixir\nconfig :pushito,\n  cert_file: \"priv/cert2.pem\",\n  key_file: \"priv/key2-noenc.pem\",\n  apple_host: \"api.push.apple.com\"\n  device_id: \"bd5c3ad01bbe4d884bf2fe8801ed77e94a71bc2e9de937c84f745f54eb4cb2f4\",\n  apns_topic: \"com.inaka.myapp\",\n  token_key_file: \"priv/APNsAuthKey_1234567890.p8\",\n  token_key_id: \"1234567890\",\n  team_id: \"THEATEAM\"\n```\n\nWhere\n- `cert_file` is the path to your Provider Certificate given by Apple\n- `key_file` is your private key, extracted from the certificate\n- `apple_host` is the apple host we want to connect:\n  -  `api.development.push.apple.com` for development\n  -  `api.push.apple.com` for production\n- `device_id` is the device's id where you want to push the notification\n- `apns_topic` is your application's id\n- `token_key_file` is the path to the token key file provided by Apple\n- `token_key_id` is the key id provided by Apple\n- `team_id` is your team developer id\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finaka%2Fpushito","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finaka%2Fpushito","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finaka%2Fpushito/lists"}