{"action":"created","issue":{"url":"https://api.github.com/repos/ToothlessGear/node-gcm/issues/92","labels_url":"https://api.github.com/repos/ToothlessGear/node-gcm/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/ToothlessGear/node-gcm/issues/92/comments","events_url":"https://api.github.com/repos/ToothlessGear/node-gcm/issues/92/events","html_url":"https://github.com/ToothlessGear/node-gcm/issues/92","id":57852605,"number":92,"title":"Are registerIds and unsents equal in length?","user":{"login":"ghominejad","id":1716698,"avatar_url":"https://avatars.githubusercontent.com/u/1716698?v=3","gravatar_id":"","url":"https://api.github.com/users/ghominejad","html_url":"https://github.com/ghominejad","followers_url":"https://api.github.com/users/ghominejad/followers","following_url":"https://api.github.com/users/ghominejad/following{/other_user}","gists_url":"https://api.github.com/users/ghominejad/gists{/gist_id}","starred_url":"https://api.github.com/users/ghominejad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghominejad/subscriptions","organizations_url":"https://api.github.com/users/ghominejad/orgs","repos_url":"https://api.github.com/users/ghominejad/repos","events_url":"https://api.github.com/users/ghominejad/events{/privacy}","received_events_url":"https://api.github.com/users/ghominejad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-02-16T21:22:15Z","updated_at":"2015-02-17T14:36:42Z","closed_at":null,"body":"I think there are some serious problems in the codes.\r\n1 - Consider you have 100 registerIds and 50 of them are unsents. so is this code correct?\r\n```JAVASCRIPT\r\n// registrationId.length is  100 items\r\nfor (i = 0; i < registrationId.length; i += 1) {\r\n    // result.results.length is same as unsents length (50 items)\r\n    if (result.results[i].error === 'Unavailable') {\r\n        unsentRegIds.push(registrationId[i]);\r\n     }\r\n}\r\n```\r\nhttps://github.com/ToothlessGear/node-gcm/blob/master/lib/sender.js#L132-L136\r\n\r\n2 - If we have some unsents then we have loss the callback results of sent items. consider we have only 1 Unavailable and 99 success items.  then it retries to send one unsent and after finishes we have only one result in callback results.\r\nhttps://github.com/ToothlessGear/node-gcm/blob/master/lib/sender.js#L154\r\n\r\n3- In gcm spec we should respect Retry-After header"},"comment":{"url":"https://api.github.com/repos/ToothlessGear/node-gcm/issues/comments/74676533","html_url":"https://github.com/ToothlessGear/node-gcm/issues/92#issuecomment-74676533","issue_url":"https://api.github.com/repos/ToothlessGear/node-gcm/issues/92","id":74676533,"user":{"login":"ghominejad","id":1716698,"avatar_url":"https://avatars.githubusercontent.com/u/1716698?v=3","gravatar_id":"","url":"https://api.github.com/users/ghominejad","html_url":"https://github.com/ghominejad","followers_url":"https://api.github.com/users/ghominejad/followers","following_url":"https://api.github.com/users/ghominejad/following{/other_user}","gists_url":"https://api.github.com/users/ghominejad/gists{/gist_id}","starred_url":"https://api.github.com/users/ghominejad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghominejad/subscriptions","organizations_url":"https://api.github.com/users/ghominejad/orgs","repos_url":"https://api.github.com/users/ghominejad/repos","events_url":"https://api.github.com/users/ghominejad/events{/privacy}","received_events_url":"https://api.github.com/users/ghominejad/received_events","type":"User","site_admin":false},"created_at":"2015-02-17T14:36:42Z","updated_at":"2015-02-17T14:36:42Z","body":"Also great thanks for making this useful library"}}