Fixes bug introduced by a3cf8b0 where the socket buffer length wasn't checked correctly.
* Feature: Certificate and Key data can be passed directly when creating a new connection instead of providing a file name on disk. (See: `certData` and `keyData` options) * Deliver whole write buffer if the socket is ready. * Fixed some global memory leaks. * Tidied up some code formatting glitches flagged by jslint * Fixes #16, #17, #18, #19, #20
Removed a global callback, raised by mypark#17
…a file so i can store multiples of them. Also fixed up a bunch of js lint error, not all of them, but most of them.
Updated the readme and package.json for release
Added encoding parameter when sending notification
…erface or not. If we aren't then we can't find which notification made things go wrong then none of the rest of the method is relevant and we can just go back to draining the writeBuffer.
Basically I've fixed architectural failings of the first release. This should be far more stable than it has been previously with hopefully not too much increased overhead.
If you send many push notifications (10k) and 10th will have invalid token, there is chance that 2k push notifications will be broken before broken pipe exception. This commit adds checking for every push message and fix bug with close event listener.
…tifications it would be reinitialised before its teardown is completed leaving the system in an undefined state.
…e whole node instance. Ideally this would give the user the option to specify an error handler in case the error is more sinister. If there is any demand for this open an issue or send a pull request.
Fencepost error with calculating the correct buffer length to store the token. This should fix an out-of-bounds error I got once with a token of incorrect length.
I'm not entirely sure I have the error checking right/sufficient. The method of queueing pending messages whilst connecting has been changed to an array which the data is pushed/shifted from as it is no longer possible to add a listener to trigger the write because the socket will change as it is recreated.
var apnsConnection = apns.connection(options); should have read: var apnsConnection = new apns.connection(options); Issue #3
Issue #1 fixed where error callback was incorrectly referenced.