{"action":"created","issue":{"url":"https://api.github.com/repos/argon/node-apn/issues/381","repository_url":"https://api.github.com/repos/argon/node-apn","labels_url":"https://api.github.com/repos/argon/node-apn/issues/381/labels{/name}","comments_url":"https://api.github.com/repos/argon/node-apn/issues/381/comments","events_url":"https://api.github.com/repos/argon/node-apn/issues/381/events","html_url":"https://github.com/argon/node-apn/issues/381","id":150306505,"number":381,"title":"GOT socketError { [Error: socket hang up] code: 'ECONNRESET', sslError: undefined }","user":{"login":"modood","id":11327898,"avatar_url":"https://avatars.githubusercontent.com/u/11327898?v=3","gravatar_id":"","url":"https://api.github.com/users/modood","html_url":"https://github.com/modood","followers_url":"https://api.github.com/users/modood/followers","following_url":"https://api.github.com/users/modood/following{/other_user}","gists_url":"https://api.github.com/users/modood/gists{/gist_id}","starred_url":"https://api.github.com/users/modood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/modood/subscriptions","organizations_url":"https://api.github.com/users/modood/orgs","repos_url":"https://api.github.com/users/modood/repos","events_url":"https://api.github.com/users/modood/events{/privacy}","received_events_url":"https://api.github.com/users/modood/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-22T08:36:35Z","updated_at":"2016-04-22T08:46:18Z","closed_at":null,"body":"no notifications arrived !!!\r\n\r\nenv:\r\n```\r\nnode: v0.10.38\r\nnpm: 2.9.0\r\napn: 1.7.5\r\n```\r\n\r\nEvent Emitted:\r\n```\r\n1.  disconnected\r\n    openSockets: 0\r\n2.  socketError\r\n    { [Error: socket hang up] code: 'ECONNRESET', sslError: undefined }\r\n```\r\n\r\ncode:\r\n```javascript\r\n#!/usr/bin/env node\r\n\r\nvar apn = require('apn');\r\n\r\nvar options = {\r\n  pfx: './Certificates.p12',\r\n  passphrase: 'balabala'\r\n};\r\n\r\nvar apnConnection = new apn.Connection(options);\r\n\r\napnConnection.on('error', function (err) {\r\n  console.log('[*] error');\r\n  console.log(err);\r\n})\r\n\r\napnConnection.on('socketError', function (err) {\r\n  console.log('[*] socketError');\r\n  console.log(err);\r\n})\r\n\r\napnConnection.on('transmitted', function (notification, device) {\r\n  console.log('[*] transmitted');\r\n  console.log(notification);\r\n  console.log(device);\r\n})\r\n\r\napnConnection.on('completed', function () {\r\n  console.log('[*] completed');\r\n})\r\n\r\napnConnection.on('cacheTooSmall', function (sizeDifference) {\r\n  console.log('[*] cacheTooSmall');\r\n  console.log(sizeDifference);\r\n})\r\n\r\napnConnection.on('connected', function (openSockets) {\r\n  console.log('[*] connected');\r\n  console.log(openSockets);\r\n})\r\n\r\napnConnection.on('disconnected', function (openSockets) {\r\n  console.log('[*] disconnected');\r\n  console.log(openSockets);\r\n})\r\n\r\napnConnection.on('timeout', function () {\r\n  console.log('[*] timeout');\r\n})\r\n\r\napnConnection.on('transmissionError', function (errorCode, notification, device) {\r\n  console.log('[*] transmissionError');\r\n  console.log(errorCode);\r\n  console.log(notification);\r\n  console.log(device);\r\n})\r\n\r\nvar token = '879af626d**************************************************3a58d';\r\nvar myDevice = new apn.Device(token);\r\n\r\nvar note = new apn.Notification();\r\nnote.expiry = Math.floor(Date.now() / 1000) + 3600; // Expires 1 hour from now.\r\nnote.badge = 3;\r\nnote.sound = \"ping.aiff\";\r\nnote.alert = \"\\uD83D\\uDCE7 \\u2709 You have a new message\";\r\nnote.payload = {'messageFrom': 'Caroline'};\r\n\r\napnConnection.pushNotification(note, myDevice)\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/argon/node-apn/issues/comments/213333044","html_url":"https://github.com/argon/node-apn/issues/381#issuecomment-213333044","issue_url":"https://api.github.com/repos/argon/node-apn/issues/381","id":213333044,"user":{"login":"modood","id":11327898,"avatar_url":"https://avatars.githubusercontent.com/u/11327898?v=3","gravatar_id":"","url":"https://api.github.com/users/modood","html_url":"https://github.com/modood","followers_url":"https://api.github.com/users/modood/followers","following_url":"https://api.github.com/users/modood/following{/other_user}","gists_url":"https://api.github.com/users/modood/gists{/gist_id}","starred_url":"https://api.github.com/users/modood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/modood/subscriptions","organizations_url":"https://api.github.com/users/modood/orgs","repos_url":"https://api.github.com/users/modood/repos","events_url":"https://api.github.com/users/modood/events{/privacy}","received_events_url":"https://api.github.com/users/modood/received_events","type":"User","site_admin":false},"created_at":"2016-04-22T08:46:18Z","updated_at":"2016-04-22T08:46:18Z","body":"output\r\n```\r\n➜  migrate git:(master) ✗ export DEBUG=apn && ./untitled.js \r\n  apn Initialising connection +0ms\r\n  apn Loading Credentials +2ms\r\n  apn 1 left to send +3ms\r\n  apn Socket error occurred +2s undefined { [Error: socket hang up] code: 'ECONNRESET', sslError: undefined }\r\n  apn Destroying connection +6ms undefined\r\n  apn Removing socket from pool +0ms undefined\r\n  apn Socket closed +1ms undefined\r\n  apn Removing socket from pool +0ms undefined\r\n[*] disconnected\r\n0\r\n  apn 1 left to send +1ms\r\n  apn Raising error: +2ms { [Error: socket hang up] code: 'ECONNRESET', sslError: undefined } undefined undefined\r\n  apn Error occurred with trace: +0ms Error: socket hang up\r\n    at SecurePair.error (tls.js:1011:23)\r\n    at EncryptedStream.CryptoStream._done (tls.js:703:22)\r\n    at CleartextStream.read [as _read] (tls.js:499:24)\r\n    at CleartextStream.Readable.read (_stream_readable.js:341:10)\r\n    at EncryptedStream.onCryptoStreamFinish (tls.js:304:47)\r\n    at EncryptedStream.g (events.js:180:16)\r\n    at EncryptedStream.emit (events.js:117:20)\r\n    at finishMaybe (_stream_writable.js:360:12)\r\n    at endWritable (_stream_writable.js:367:3)\r\n    at EncryptedStream.Writable.end (_stream_writable.js:345:5)\r\n[*] socketError\r\n{ [Error: socket hang up] code: 'ECONNRESET', sslError: undefined }\r\n  apn Initialising connection +1s\r\n  apn 1 left to send +1ms\r\n  apn Socket error occurred +2s undefined { [Error: socket hang up] code: 'ECONNRESET', sslError: undefined }\r\n  apn Destroying connection +2ms undefined\r\n  apn Removing socket from pool +0ms undefined\r\n  apn Socket closed +1ms undefined\r\n  apn Removing socket from pool +0ms undefined\r\n\r\n```"}}