Switch away from Apnotic - #34
Merged
Merged
Conversation
intrip
force-pushed
the
nix-apnotic
branch
5 times, most recently
from
September 19, 2025 08:55
24cdcf2 to
4b3ad1d
Compare
intrip
marked this pull request as ready for review
September 19, 2025 12:30
intrip
force-pushed
the
nix-apnotic
branch
5 times, most recently
from
September 23, 2025 07:56
4ebc7e5 to
9b4999b
Compare
Removes the `apnotic`→`net-http2` depencency in favor of a custom implementation using the `httpx` client. **Backward compatibility:** The `apple_data` payload now expects a format which matches exactly the [APNs API](https://developer.apple.com/documentation/usernotifications/generating-a-remote-notification#Payload-key-reference). Previously, the [Apnotic](https://github.com/ostinelli/apnotic) format was used instead. The key differences are: - The field keys now use dash `-` as a separator instead of an underscore `_`. - The header fields can be overridden using their exact name, e.g. `apns-priority` instead of a custom name set by Apnotic (`priority`). *before:* ```ruby notification = ApplicationPushNotification .with_apple(category: "observable", thread_id: "greeting", priority: "1") .new(title: "Hello world!") ``` *after:* ```ruby notification = ApplicationPushNotification .with_apple(aps: { category: "observable", "thread-id": "greeting"}, "apns-priority": "1") .new(title: "Hello world!") ``` There is a temporary backward-compatibility layer which takes care of the translation from the Apnotic format, but it will be removed in the next release. See #25 (comment)
intrip
commented
Sep 23, 2025
|
|
||
| headers, payload = headers_from(notification), payload_from(notification) | ||
| Rails.logger.info("Pushing APNs notification: #{headers[:"apns-id"]}") | ||
| response = httpx_session.post("https://api.push.apple.com/3/device/#{notification.token}", json: payload, headers: headers) |
Collaborator
Author
There was a problem hiding this comment.
Whops! Just noticed that the url is not relative. Will fix that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the
apnotic→net-http2depencency in favor of a custom implementation using thehttpxclient.Backward compatibility:
The
apple_datapayload now expects a format which matches exactly the APNs API. Previously, the Apnotic format was used instead.The key differences are:
-as a separator instead of an underscore_.apns-priorityinstead of a custom name set by Apnotic (priority).before:
after:
There is a temporary backward-compatibility layer which takes care of the translation from the Apnotic format, but it will be removed in the next release.
See #25