Comments (11)
In order to send VOIP push notifications we need to set
$this->headers[self::HEADER_APNS_PUSH_TYPE] = 'voip';
from pushok.
I've tried adding that on Request.php but it also needs to be set
$this->headers[self::HEADERS_APNS_TOPIC] == bundleId."voip"
When I'm doing the auth I know I'm sending that header but I can't retrieve it from Request.php (I don't know how, I've tried multiple stuff).. so what I did waws, a sort of a hack, sending a customValue (from my app) on the payload, and updating Request.php with the following code
// new header required to support iOS 13
$this->headers[self::HEADER_APNS_PUSH_TYPE] = 'alert';
$payload = $notification->getPayload();
try {
$apnsTopic = $payload->getCustomValue(self::HEADER_APNS_TOPIC);
} catch (InvalidPayloadException $e) {
}
if ($notification->getPayload()->isContentAvailable()) {
$this->headers[self::HEADER_APNS_PUSH_TYPE] = 'background';
}
if (isset($apnsTopic) && !empty($apnsTopic)) {
$this->headers[self::HEADER_APNS_TOPIC] = $apnsTopic;
$this->headers[self::HEADER_APNS_PUSH_TYPE] = 'voip';
}
But I know this is not ideal, and we might just recover that value (appBundleId) from the headers and then we might add a validation if strpos($appBundleId, 'voip')
then we can set $this->headers[self::HEADER_APNS_PUSH_TYPE] = 'voip'
I would like to work in a patch, but I'm trying to understand the codebase and why that header is "lost" after the authentication :/
from pushok.
But can we check if HEADER_APNS_TOPIC
exists, then add HEADER_APNS_PUSH_TYPE=void
?
if ($notification->getPayload()->isContentAvailable()) {
$this->headers[self::HEADER_APNS_PUSH_TYPE] = 'background';
} elseif (isset($this->headers[self::HEADER_APNS_TOPIC]))
$this->headers[self::HEADER_APNS_PUSH_TYPE] = 'voip';
}
from pushok.
@edamov I'll try this today and I'll let you know if it works. Thanks!
from pushok.
Hmm I think I misunderstood you, how come I can have $this->headers[self::HEADER_APNS_TOPIC]
with the value of the bundleId."voip" ? automatically, as this is being sent when we authenticate against apple api?
from pushok.
Seems now I understand what do you mean 😃
Request
class is not accessible. We need to improve Request
class with the code I wrote above.
Will it make sense? Can you create PR?
from pushok.
Ok I will create the PR with this code, although I will create a branch with the modifications I need to make it work on my project, then after when everything is upstream I'll point to that branch.
Thanks!
from pushok.
I made a PR: #91 that will solve the voip part.
from pushok.
Thanks!
I just found there are much more push types like mdm
, fileprovider
, complication
.
It is very good that it is possible now to set them
from pushok.
I tried to send voip push notifications, but apparently this package doesn't automatically add a .voip
suffix to the bundle id.
voip
...
If you set this push type, the apns-topic header field must use your app’s bundle ID with .voip appended to the end.
from pushok.
Apparently, we can close this issue along with this one #97
from pushok.
Related Issues (20)
- Support PHP 8
- Uncaught Exception HOT 3
- Package spomky-labs/jose is abandoned, you should avoid using it. Use web-token/jwt-framework instead. HOT 1
- Deprecation notices with PHP 8.1 HOT 4
- Question: Push Notifications for PkPass Updates HOT 8
- send a notification on a chosen date HOT 1
- Updating a badge HOT 1
- Support for creating WeatherKit JWT tokens
- The `Alert` option is set in the code but there is no Alert on the phone
- Package fgrosse/phpasn1 is abandoned HOT 2
- Started getting InvalidArgumentException "Unable to load the key." HOT 4
- Live Activities Supported? HOT 3
- Laravel Vapor - HTTP/2 stream 15 was not closed cleanly before end of the underlying stream HOT 3
- 0.15.x is no longer compatible with PHP 8.0 HOT 4
- HTTP/2 stream was not closed cleanly: REFUSED STREAM HOT 9
- Sending `Alert` as `Background` due to `content-available` set HOT 1
- php 8.0 via command package not installed
- Random "Send failure: Broken pipe" error
- Need to add custome key/value to aps HOT 2
- curl error when pusing to apns HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pushok.