{"action":"created","issue":{"url":"https://api.github.com/repos/web-push-libs/web-push-php/issues/66","repository_url":"https://api.github.com/repos/web-push-libs/web-push-php","labels_url":"https://api.github.com/repos/web-push-libs/web-push-php/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/web-push-libs/web-push-php/issues/66/comments","events_url":"https://api.github.com/repos/web-push-libs/web-push-php/issues/66/events","html_url":"https://github.com/web-push-libs/web-push-php/issues/66","id":195504189,"number":66,"title":"For a few days I saw that notification sending does't work","user":{"login":"yourchoice","id":531720,"avatar_url":"https://avatars.githubusercontent.com/u/531720?v=3","gravatar_id":"","url":"https://api.github.com/users/yourchoice","html_url":"https://github.com/yourchoice","followers_url":"https://api.github.com/users/yourchoice/followers","following_url":"https://api.github.com/users/yourchoice/following{/other_user}","gists_url":"https://api.github.com/users/yourchoice/gists{/gist_id}","starred_url":"https://api.github.com/users/yourchoice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yourchoice/subscriptions","organizations_url":"https://api.github.com/users/yourchoice/orgs","repos_url":"https://api.github.com/users/yourchoice/repos","events_url":"https://api.github.com/users/yourchoice/events{/privacy}","received_events_url":"https://api.github.com/users/yourchoice/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-12-14T11:15:34Z","updated_at":"2016-12-22T12:03:46Z","closed_at":null,"body":"I have around 2000 users subscribed.  I used version v1.3.2.\r\n\r\nPush notif. worked well when I had around 1000 users.  For a few days I saw that nothing received.\r\n\r\nI have log file of notification sending. These appear as sent, but nothing received.\r\n\r\nHere is an example:\r\n\r\n#2016-12-14 11:00:01\r\n- Push via Batch:  UserId: #2,  MemberId: #172184\r\n- Endpoint: https://android.googleapis.com/gcm/send/fD5ma5PXGMA:APA91bE0_XgEI4yuFZqAIWosyazxs96ONHbuuKU9Wfd2ZFp7Sj_6zvNiLCIKSuph85740K2ZCJhAK2e9atTk-dv8zBd7Ju9O--_Mh-4SsNv6cUKWDt9PERLaNuqbcRI-rEN_OgjseUw9\r\n- Notif list: [{\"id\":\"41\",\"title\":\"....\",\"lang\":\"...\",\"ri\":\"0\",\"vibrate\":null,\"url\":\"....\",\"actions\":null}]\r\n- Result: bool(true)\r\n\r\nI have returned bool(true) for all users around (2000), but seems that they not received. \r\n\r\n\r\nThis is a section of code that a few days ago worked:\r\n\r\n```\r\n$client = new \\Buzz\\Client\\MultiCurl();//$client = new \\Buzz\\Client\\Curl();\r\n$client->setOption(CURLOPT_CAINFO, $this->certKeysPath.'cacert.pem');\r\n$webPush = new WebPush($this->webPushAuth, $this->webPushDefaultOptions, null, $client);\r\n....\r\nwhile (get users from db) {\r\n   //send all notifications in a single push\t\t\t\t\t\r\n   $r = $webPush->sendNotification(\r\n       $dao_wpn_user->wpn_user_endpoint,\r\n\tjson_encode($notif_list),\r\n\t$dao_wpn_user->wpn_user_key_pub,\r\n\t$dao_wpn_user->wpn_user_key_auth\r\n\t//, true //do flush\r\n    );\r\n    //write log\r\n    $this->wpnLog($dao_wpn_user->toArray(), $notif_list, $r);\r\n}\r\n$webPush->flush();\r\n....\r\n```\r\n\r\nPlease, any idea how I can debug that? Regarding google dev console or firebase, exists there  a way to can see what notif. are sent ?\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/web-push-libs/web-push-php/issues/comments/268786216","html_url":"https://github.com/web-push-libs/web-push-php/issues/66#issuecomment-268786216","issue_url":"https://api.github.com/repos/web-push-libs/web-push-php/issues/66","id":268786216,"user":{"login":"Minishlink","id":82368,"avatar_url":"https://avatars.githubusercontent.com/u/82368?v=3","gravatar_id":"","url":"https://api.github.com/users/Minishlink","html_url":"https://github.com/Minishlink","followers_url":"https://api.github.com/users/Minishlink/followers","following_url":"https://api.github.com/users/Minishlink/following{/other_user}","gists_url":"https://api.github.com/users/Minishlink/gists{/gist_id}","starred_url":"https://api.github.com/users/Minishlink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Minishlink/subscriptions","organizations_url":"https://api.github.com/users/Minishlink/orgs","repos_url":"https://api.github.com/users/Minishlink/repos","events_url":"https://api.github.com/users/Minishlink/events{/privacy}","received_events_url":"https://api.github.com/users/Minishlink/received_events","type":"User","site_admin":false},"created_at":"2016-12-22T12:03:46Z","updated_at":"2016-12-22T12:03:46Z","body":"Notifications are sent in parallel in batches of 100, and you can look at the errors with a 100 keys arrays:\r\n```php\r\n$counter = 0;\r\nwhile (($user=$dao->fetch())==true) {\r\n    $webPush->sendNotification($user['endpoint'], json_encode($notif_list), $user['key_pub'], $['key_auth']);\r\n\r\n    if($counter>0 && $counter%100==0) {\r\n         $arr_rf = $webPush->flush();\r\n          foreach ($arr_rf as $rf) {\r\n             // handle error\r\n          }\r\n    }\r\n}//end while\r\n```\r\nNote that in your code, the X notifications after your last batch of 100 will not be sent, you should fix your code.\r\n\r\nNotifications are sent one by one, so you can look at each error one at a time:\r\n```php\r\nwhile (($user=$dao->fetch())==true) {\r\n    $r = $webPush->sendNotification($user['endpoint'], json_encode($notif_list), $user['key_pub'], $['key_auth'], true);\r\n    if($r===true) {\r\n       ... //store notification as sent to $user['id'];\r\n    }\r\n    else {\r\n       ...//store err log for $user['id'];\r\n    }\r\n}//end while\r\n```\r\n\r\nYou can't do both as you can't get the result of a request before it has been sent."}}
{"actor":{"display_login":"Minishlink"}}