node-apn / node-apn

:calling: Apple Push Notification module for Node.js
MIT License
4.39k stars 687 forks source link

At APN@2.1.1 the send promise sometimes wasn't call #451

Closed casevictor closed 8 years ago

casevictor commented 8 years ago

I'm using the latest version, just like the examples but sometime after a period of time or a number of messages sent, the promise wasn't call until I restarted de App.

Anyone got this behavior also?

iliraga commented 8 years ago

Got this as well... running a REST API on node with underlying node-apn to send notifications.

The first notification is sent properly with the promise methods called. Further notifications are not sent, until i reconnect (new instance of apn.provider)

Greetings

casevictor commented 8 years ago

Duplicate of #449

casevictor commented 8 years ago

@iliraga do you had a workaround for that? I tried to compare apnConnection with null but did'nt work.

iliraga commented 8 years ago

@casevictor I reconnect each time I want to resend stuff through a lazy apnConnection-Initializer. The old instance is usually killed by the GC because no reference to it can be found anymore then. So for each send-batch I reconnect to APNs... Jeah I know it's bad.

casevictor commented 8 years ago

@florianreinhart Do you have a clue about what going on with this socket problem ? Maybe it is a node bug?

florianreinhart commented 8 years ago

I have no idea. However, I have the feeling that the node-http2 module has some issues. We currently have to use custom fork that fixes a leak. A PR has been submitted, but not yet merged, see PR200 and PR222.

Once Node.js has official HTTP/2 support we will switch to that asap.

florianreinhart commented 8 years ago

@casevictor Could this node-http2 issue be the reason for your initial issue?