Closed squeedee closed 13 years ago
Are you using the EM::APN.push
interface or the Client
directly?
Thanks for the gist. Sadly, the client does not reconnect automatically. There is re-connection logic, but it's actually handled in the higher-level EM::APN.push
interface. That simplified interface keeps around a memoized Client instance, and when it detects that it has disconnected, simply creates a new one.
Why not just call reconnect
inside unbind
? IIRC, if a high rate of messages were being delivered and the connection dropped and re-connected, there was actually a strong possibility of messages being lost. I'm not sure why, but I'm pretty sure I was seeing that. Creating a new instance on connection failures was actually more reliable.
All that said, I haven't looked into it in a while. Perhaps the latest EM handles reconnects more gracefully. Maybe some sort of deferrable hanging on the connection status would solve things.
git show e1d72351b043c39bf157eb35b9c3cd1e3bab9468
. Ah, nostalgia.
I'll just do what you're doing in my code. All good - thankyou for your responsiveness. Can I ask, are groupme behind this? is it/will it be in their production systems?
Yup, this was written for GroupMe and is used in production.
When I send an invalid token i get:
I, [2011-11-11T11:56:32.038103 #41783] INFO -- : TOKEN=df6f35d25288c0be4ed6e91cc404439c1b79b02999d662c7d65b139289bcbdc0 I, [2011-11-11T11:56:32.173585 #41783] INFO -- : CODE=8 ID=256 DESC=Invalid token Got data: [8, 8, 256]
The last line is my on_receipt output.
If i then send a valid token i see
I, [2011-11-11T11:56:54.579125 #41783] INFO -- : TOKEN=520b12a526c0788425e5c9f6a7fd069eaf99d5ddda296fad2317b0e2dc9e44aa
and nothing further.
If i then send a broken token again, i do not get a reciept.
This makes me think that em-apn is not reestablishing the connection, and not letting us know it's down.