Browse Source

if a subscriber returns HTTP 410, deactivate the subscription

master
Aaron Parecki 7 years ago
parent
commit
918b10de69
No known key found for this signature in database GPG Key ID: 276C2817346D6056
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      lib/PushTask.php

+ 8
- 0
lib/PushTask.php View File

@ -181,6 +181,14 @@ class PushTask {
if(request\response_is($response['status'], 2)) { if(request\response_is($response['status'], 2)) {
$subscription->last_ping_success = 1; $subscription->last_ping_success = 1;
$subscription->last_ping_error_delay = 0; $subscription->last_ping_error_delay = 0;
} elseif($response['status'] == 410) {
// If the subscriber returns HTTP 410, then take that as an indication that they no longer want more notifications and deactivate this subscription
// https://github.com/w3c/websub/issues/106
// https://github.com/w3c/websub/issues/103
echo "Deactivating subscription based on HTTP 410 response returned\n";
$subscription->last_ping_success = 0;
$subscription->active = 0;
} else { } else {
$subscription->last_ping_success = 0; $subscription->last_ping_success = 0;
// If the ping failed, queue another ping for a later time with exponential backoff // If the ping failed, queue another ping for a later time with exponential backoff

Loading…
Cancel
Save