fix notify
This commit is contained in:
parent
7aefdcca3d
commit
7bc211dc37
3 changed files with 6 additions and 4 deletions
|
@ -62,7 +62,7 @@ class CalendarListener implements IEventListener {
|
|||
foreach($subscriptions as $subscription) {
|
||||
$transport = $this->transportManager->getTransport($subscription->getTransport());
|
||||
try {
|
||||
$transport->notify($subscription->getUserId(), $collectionName, json_decode($subscription->getData(), True));
|
||||
$transport->notify($subscription->getUserId(), $collectionName, $subscription->getId());
|
||||
} catch (Error $e) {
|
||||
$this->logger->error("transport " . $subscription->getTransport() . " failed to deliver notification to subscription " . $subscription->getId());
|
||||
}
|
||||
|
|
|
@ -79,9 +79,11 @@ class WebPushTransport extends Transport {
|
|||
];
|
||||
}
|
||||
|
||||
public function notify(string $userId, string $collectionName, $data) {
|
||||
public function notify(string $userId, string $collectionName, int $subscriptionId) {
|
||||
$xmlService = new Service();
|
||||
|
||||
$pushResource = $this->webPushSubscriptionService->findBySubscriptionId($subscriptionId)->getPushResource();
|
||||
|
||||
$content = $xmlService->write('{DAV:Push}push-message', [
|
||||
'{DAV:Push}topic' => $collectionName,
|
||||
]);
|
||||
|
@ -94,7 +96,7 @@ class WebPushTransport extends Transport {
|
|||
];
|
||||
|
||||
$context = stream_context_create($options);
|
||||
$result = file_get_contents($data["pushResource"], false, $context);
|
||||
$result = file_get_contents($pushResource, false, $context);
|
||||
}
|
||||
|
||||
public function getSubscriptionIdFromOptions($options): ?int {
|
||||
|
|
|
@ -67,5 +67,5 @@ abstract class Transport {
|
|||
// Change mutable options of the subscription (if any exist)
|
||||
abstract public function updateSubscription($subsciptionId, $options);
|
||||
|
||||
abstract public function notify(string $userId, string $collectionName, $data);
|
||||
abstract public function notify(string $userId, string $collectionName, int $subscriptionId);
|
||||
}
|
Loading…
Reference in a new issue